[fpc-devel] Linking to C++

Bogusław Brandys brandys at o2.pl
Tue Jan 23 08:56:16 CET 2007

Jason P Sage wrote:
> Hello All,
> This may have been mentioned with different words already - but I'm getting
> the impression one should write a "C++ handler API" or "thin layer" for the
> C++ lib one wants to utilize. The idea being FPC would only link on standard
> calls that more or less ran the underlying C++ lib like a remote control car
> (if that makes sense). On the FPC side you would tell the "thin layer" what
> objects to make, and allow for passing information to and from individual
> instances of classes within the "thin client", and invoking methods the same
> way.
> This doesn't seem ideal by any stretch of the imagination - and makes me
> think of ugly things in time's past like 32bit to 16bit "thunking", but this
> kind of "thin layer" coding (an API ultimately) seems like it MAY be the
> best way to link to the various libraries out there. I'm thinking of gcc and
> Microsoft API's generally.
> Personally - regardless of the difficulties - I've had some pretty decent
> luck with FPC and using the headers that people have created for various
> libraries that are crucial - like mysql and odbc. If I had more time to mess
> around I'd be playing with Direct X and Open GL too. Regardless - I'm happy
> with it so far!
> I welcome any and all comments. 
> Good Day
> Jason P Sage

If libraries are using pure C then you are lucky.If C++ ,then the only 
reasonable way for me is a thin wrapper DLL(s) :-(
Of course you can use perl/python or create own object parser (in FPC) 
to actually recognize current mangling of functions but as you know it's 
not enough.All depends of how C++ classes are structured.afaik Qt is 
using some kind of parser also but I don't know the details.


More information about the fpc-devel mailing list