[fpc-devel] Dynamically Loading Libraries

Joost van der Sluis joost at cnoc.nl
Tue Nov 3 12:46:06 CET 2009

On Mon, 2009-11-02 at 17:13 -0300, Luiz Americo Pereira Camara wrote:
> Ivo Steinmann escreveu:
> > Vincent Snijders schrieb:
> >> Maybe it is better to generate a foobar_dyn.inc based on the
> >> foobar.inc or generate both foobar.inc and foobar_dyn.inc from a
> >> common file format (maybe even the original header file)
> >
> >   
> [..]
> > Most libraries are translated by a tool like h2pas from the original
> > headers and then rehashed manually. The best solution would be, if
> > there's a tool that generates the var procedures directly from all
> > external procedures.
> I think that creating a tool to translate a static header to a dyn 
> header should be easy to create (i'm not talking to convert c header 
> directly ;-)).
> Should do the following right? Correct me if i'm wrong:
> Static function:
> function foobar_dosomething(a:cint; b:cdouble): cint; extdecl;external 
> foobarlib;
> Becomes a dyn function:
> var foobar_dosomething: function(a:cint; b:cdouble): cint; extdecl;
> I can write such tool.

I have made such a tool, which I used for the database-bindings. I don't
know if I still have it tough, and it was very rough.

But it's easy doable, indeed.


More information about the fpc-devel mailing list