[fpc-pascal] C++ Name Mangling

Matt Emson memsom at interalpha.co.uk
Thu Mar 15 09:47:29 CET 2007

> One thing that confuses me is: Shouldn´t the mangled name be written
> somewhat on the .LIB file?

Not if the linker understands how to mangle names, no. Also depends on what
the LIB file is used for, no? ELF would not need it, PE would require it,
and PEF would use is only when debugging - those are just the 3 formats I
know of ;-) Does Symbian use PE? I know the old Psion stuff used a very DOS
like command line interface... don't know how far that way they went?!

You might not like what I'm about to say, but writing a C wrapper around the
C++ and then linking the Pascal code to the C wrapper is a far, far safer
way to get consistent results. C++ compilers are a law unto themselves, and
rules change with every version, as has been alluded to already. You will
have a lot more stable and successful experiences with a layer between the
C++ and Pascal. If you write a C wrapper, the code will be portable to other
C++ compilers.

More information about the fpc-pascal mailing list