[fpc-devel] Linking to C++

Daniël Mantione daniel.mantione at freepascal.org
Mon Jan 22 21:15:47 CET 2007



Op Mon, 22 Jan 2007, schreef Felipe Monteiro de Carvalho:

> So, basically, what I mean with this is: What is needed to add C++
> linking to Free Pascal? It seams to me that it should be easy, we just
> need to understand C++ name mangling and choose a sintax to implement
> it. Maybe something like this:

If it were that easy it would have been implemented a long time ago. The 
main problem with C++ is that the supporting structures, such as the VMT 
are totally different from Pascal. One of the reasons is that multiple 
inheritance needs to be supported in C++. Of the problems, that will for 
example occur, is to call a virtual C++ method, this needs VMT access, 
which the compiler cannot provide.

Of course, you can import a class like you did, and even automate it, I 
don't see a problem with adding C++ mangling. But, you cannot use class 
syntax, since classes are fundamentally incompatible with C++ classes.

Daniël


More information about the fpc-devel mailing list