[fpc-pascal](no subject)

Jonas Maebe jonas at zeus.rug.ac.be
Sat Oct 26 15:55:08 CEST 2002

On Fri, 25 Oct 2002, Lee, John wrote:

> 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.


More information about the fpc-pascal mailing list