[fpc-devel] Dynamically Loading Libraries
jepjoh2 at kom.aau.dk
Wed Nov 11 11:49:30 CET 2009
Marco van de Voort wrote:
> In our previous episode, Jeppe Johansen said:
>>> -Ivo Steinmann
>> 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.
I don't know if I'm making a fool of myself, but what systems? Skimming
the sources, I couldn't find any mention of it in the ELF writers. An
external symbol will simply be linked to the first occurrence of a
matching symbol in the first shared or static object(unless there's some
name mangling going on that I didn't spot). The COFF writer already does
it the way I suggested.
>> 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.
In principle, doing it this way would make cross compiling to an ELF
platform with dynamic linking easier, once the internal ELF linker is
made. Since the dynamic linked symbols and their locations will be known
More information about the fpc-devel