[fpc-devel] Linking to C++

Dominique Leducq dleducq at magellan-ing.fr
Tue Jan 23 15:28:20 CET 2007


On Tue, 23 Jan 2007 08:36:13 -0200
"Felipe Monteiro de Carvalho" <felipemonteiro.carvalho at gmail.com> wrote:

> On 1/23/07, Bogusław Brandys <brandys at o2.pl> wrote:
> > 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) :-(
> 
> But imagine if we require a dll to create apps for a operating system.
> omg, that would look like vb!!! =)
> 
> It´s a no-no-no for me.
> 
> There are some factors which make this problem less problematic with
> Symbian OS. The operating system has only 1 binary of one version
> being distributed. It is not going to be compiled with odd compilers
> that change name mangling, so the libraries on symbian os have exactly
> 1 name mangling, which is from one of the recent GCCs. That should be
> enougth to avoid external dlls.
> 
> -- 
> Felipe Monteiro de Carvalho

Did anyone have a look at Swig ? (http://www.swig.org)
pascal is not supported yet, but it makes much more sense IMHO to add a (object) pascal module to Swig than reinvent the wheel and add some bloat to the compiler.

Basically, Swig automatically generates wrappers for C/C++ code to be used by other programing languages. Initially mainly scripting languages where targeted, but now some compiled languages are supported too.
Most of C++ features are supported.
C++ classes are flattened to present a C-like interface, and if the target language supports it, they are wrapped in proxy classes in it.
There are plenty of features, and the documentation is extensive and well written, with lot of examples.

Dominique Leducq




More information about the fpc-devel mailing list