[fpc-devel] Dynamically Loading Libraries

Joost van der Sluis joost at cnoc.nl
Thu Nov 12 10:42:52 CET 2009

On Wed, 2009-11-11 at 11:25 +0100, Marco van de Voort wrote:
> In our previous episode, Jeppe Johansen said:
> > >
> > > -Ivo Steinmann
> > > <http://www.dict.cc/englisch-deutsch/criticism.html>
> > >   
> > What about saying that
> >     procedure proc; external 'libname' name 'proc';
> > denotes a function that's dynamically loaded implicitly, while
> >     procedure proc; external name 'proc';
> > denotes a static linked function.
> This syntax is not possible. The external 'xxx' name 'proc' is there for a reason,
> for systems with multiple linker namespaces. Moreover there is already an
> enormous codebase that uses this.
> > In my opinion that seems like the only logical solution. Explicit 
> > dynamic loading will ofcourse still be possible, but you wouldn't need 
> > tools or lots of ifdefs
> You still need to define which functions must be there to start. 
> > I'm not aware of how well it would work on Mac platforms, but I'm mostly 
> > certain most GNU/Linux and BSD's, and Windows has support for implicit 
> > dynamic linking in the executable formats
> > 
> > This is ofcourse a solution that would require modification of the 
> > compiler, but I think in the long run that it'll make alot of things 
> > more comprehensible
> I don't. I think this dynamically loading of headers has already gone to
> far. It is a good workaround for a few headers that are versionwise a
> disaster, like MySQL, but universally, it doesn't solve problems.

Offcourse it does. Only with more stable headers you never notice
because you never has to change them. Well, that is, after the first
convertion to pascal. But as you do this first conversion, this is
really usefull.

Now, on the contrary, there are 10 different ways to mimic this
behaviour, every library uses it's own way. Which is not usefull for the

Besides, it is an optimisation. Oracle for example exports more then 500
functions headers. Those are all initialised at start, maybe 20 are
used. Those can be eliminated. 


More information about the fpc-devel mailing list