[fpc-devel] Dynamically Loading Libraries

Vincent Snijders vsnijders at vodafonevast.nl
Mon Nov 2 21:52:53 CET 2009


Luiz Americo Pereira Camara schreef:
> Vincent Snijders escreveu:
>> Luiz Americo Pereira Camara schreef:
>>>
>>> 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;
>>>
>> And a statement to initialize the variable.
>>
> 
> Do you mean this?
> 
> sqlite3_symbols: array[0..152{$IFDEF SQLITE_OBSOLETE}+6{$ENDIF}] of 
> TLibSymbol = (
>    (pvar:@sqlite3_libversion; name:'sqlite3_libversion'; weak:false), etc..
> 

That is one solution, filling the symbols array.

Another solution is simply:
@sqlite3_libversion := GetProcAddress(libHandle, 'sqlite3_libversion');

I was pointing at a missing link.

Vincent



More information about the fpc-devel mailing list