[fpc-pascal] C++ and Free Pascal

Marco van de Voort marcov at stack.nl
Wed Mar 16 08:49:13 CET 2005


> Peter Vreman said:
> > (not methods) declared with cdecl it'll be possible.
> 
> Do you mean possible to link the C++ to a pascal unit, or vice-versa?
> 
> As far as linking the C++ into a pascal unit goes, I could possibly manage
> to write a wrapper library (in C++)

(in plain C)

> where I could maybe make a struct for the data and pass it to all of the
> functions, and then link them all into pascal with the cdecl stuff, and
> then maybe even make a pascal object that's a wrapper for those things,
> but it just sounds like it would get uglier and uglier as we go...  The
> general answer of "it's not possible" is acceptable to me.
 
> Maybe we can go the other way, though?  Maybe I can make a unit full of
> objects in pascal, and then link that to C++ programs.  Would that be
> possible without having to put wrappers over wrappers, or am I pretty much
> stuck maintaining the library in both C++ and Pascal if I want it in both?

Gives same problem. Object models are simply not the same. It's not just C++
vs Pascal, but e.g. the same problem between two C++ compilers or between FPC
and Delphi. 





More information about the fpc-pascal mailing list