Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-10

RE: (no subject)

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lee, John

Looks quite tricky stuff...You could try translating it, but as you indicate it would not be easy...it'd be better IMHO to keep it as C++ & interface to it, because that way you would be able to take advantage of the testing done by the author & others & not have to re test extensively. Any faults flagged by other C++ users could be easily incorporated - retesting & then finding the faults would be non trivial I guess...

So my vote is for the wrapper... assuming that can be done easily...others will tell you about that!

Regards John

Earlier message 52 lines
-----Original Message----- From: Cox, Stuart SRM:EX Sent: Friday, October 25, 2002 17:41 To: 'Free Pascal Group' Subject: [fpc-pascal](no subject) Hello all, I'm interested in geometric algorithms and I do most of my serious work in Pascal. The link below is to a polygon overlay algorithm in C++. http://home.attbi.com/~msleonov/pb.html It is quite beyond me to translate this into object Pascal of any flavor. If it was possible to translate it into Pascal, could the resulting translation be used by all Pascal programmers in accord with the licensing scheme accompanying the original C++ code? Would it be better to compile the PolyBoolean C++ code as, say, a .DLL and then write an interface to it in Pascal. Would anyone care to help in advising me on these matters? Thanks. Stuart Cox Map Generalization Technician, not Terrestrial Information Branch Ministry of Sustainable Resource Management ······················································ Phone: (250)387-5529 FAX: (250)356-9430 email View the FMIB Website at: http://srmwww.gov.bc.ca/tib/ "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." Kristian Wilson, Nintendo, Inc, 1989 Get off couch, Ottawa tells overweight kids Last Updated Fri, 05 Apr 2002 23:22:23 EDMONTON - Canadian children are increasingly overweight and that spells trouble for the country's medical system, Health Minister Anne McLellan says. She wants kids to get off the couch and out the door. The minister has her work cut out for her, according to Sue Varano, who Catholic School in Toronto. "They spend a lot of time in front of the TV, also playing video games, less time playing outside."
Jonas Maebe
to Lee, John
John wrote 9 lines
Looks quite tricky stuff...You could try translating it, but as you indicate it would not be easy...it'd be better IMHO to keep it as C++ & interface to it, because that way you would be able to take advantage of the testing done by the author & others & not have to re test extensively. Any faults flagged by other C++ users could be easily incorporated - retesting & then finding the faults would be non trivial I guess... So my vote is for the wrapper... assuming that can be done easily...others will tell you about that!

A wrapper would be best indeed, but you'd need a C wrapper first because we cannot interface directly with C++ classes. The main reason is that all C++ compilers do their name mangling differently and as such it's almost impossible to derive a symbol name from a C++ declaration. It's similarly afaik impossible to use C++ libraries generated by one compiler with another one. Sometimes you can't even share them between different versions (like with gcc 2.9x and 3.1).

However, if you create a C wrapper, then you can compile that one with the same compiler that's used to compile the C++ library, so you won't have problems there. Further, plain C name mangling is quite simple and fully supported, so you can then create a Pascal interface for this C library.

Jonas