[fpc-devel] a shared library suggestion

Michalis Kamburelis mkambi at poczta.onet.pl
Wed May 10 12:45:52 CEST 2006


peter green wrote:
> yeah that technique requires far less stubs but it means that the coder has
> to manually call an init function.
> 

Not necessarily, because you can load all addresses in initialization
section of the unit. That's what I do in my various wrappers.

> also how does your code respond if one of the entry points isn't found?
> 

Looking at ibase60.inc, in this case the error is ignored (i.e. the
entry point is left as "nil", this will result in error at runtime if
you try to call this function). But the technique is flexible --- you
could as well check GetProcedureAddress result and raise exception like
"entry point %s missing" if it's nil.

This technique also allows you to try to load from various dll/so names,
if you're not sure what the precise lib name will be on user system.
This is even used ibase60dyn, as it tries to load first fbclib then (if
that fails) gdslib (e.g. 'libfbclient.so' or 'libgds.so' on Unix). So it
will work with both Interbase and "clean" (not forced to be compatible
with Interbase) Firebird installations.

Michalis



More information about the fpc-devel mailing list