[fpc-devel] Dynamically Loading Libraries

Ivo Steinmann ivo_steinmann at gmx.net
Mon Nov 2 20:58:17 CET 2009


Vincent Snijders schrieb:
> Ivo Steinmann schreef:
>> Hello all
>>
>> I started some wiki for dynamic loading libraries support discussion.
>>
>> http://wiki.freepascal.org/Dynamically_loading_headers
>>
>> I already added an experimental implementation. If you have got some
>> ideas, whises and criticism, don't hesitate to write.
>>
>
> I don't like the looks of lines like:
> {$IFDEF S}function{$ELSE}var{$ENDIF}foobar_dosomething{$IFDEF D}:
> function{$ENDIF}(a:cint; b:cdouble): cint; extdecl;{$IFDEF S}external
> foobarlib;{$ENDIF}
>
> They are hard to read. I understand that this way makes sure that both
> static and dynamical declaration are in sync, but the loss of
> readability is too much.
>
> 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).
>
> Vincent
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>

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.

But else it's much simpler to maintain a construct as the one above than
allways starting from the orignal h file or updating allways both
declarations. I know what i'm talking about, since I translated about 15
headers in /fpc/packages ^^

But of course you are right, it's not the "nice" solution ;) The best
solution would be to have got some support from the compiler itself ;)

-Ivo Steinmann





More information about the fpc-devel mailing list