dynamic library building and loading

Iain Buclaw ibuclaw at ubuntu.com
Mon Oct 1 08:27:49 PDT 2012


On 1 October 2012 16:06, Johannes Pfau <nospam at example.com> wrote:
> Am Mon, 01 Oct 2012 15:11:49 +0200
> schrieb Jacob Carlborg <doob at me.com>:
>
>> On 2012-10-01 12:42, Johannes Pfau wrote:
>>
>> > There are some reasons for dynamic libraries linked at compile time,
>> > one is that we have to start somewhere and they are required for
>> > plugins / dynamically loaded libraries as well ;-)
>> >
>> > So I started a small test suite for GDC (could be adapted to other
>> > compilers). It currently only tests compile time linking of dynamic
>> > libraries, but adjusting the test to use runtime loading should be
>> > easy. But it's pointless as long as we have no runtime support.
>> > https://github.com/jpf91/dso-test
>>
>> Isn't "dmain2" used when building shared libraries using GDC? That's
>> where the implementation of "rt_init" is located.
>>
>
> the problem is that we don't want the C main function in a shared
> libgdruntime.so, because you might want to use libgdruntime.so in a
> C/C++ app which has it's own main function.
>

That is at least one of the theories behind it anyway. :-)

The more I think about it, the less I think I would want a C++ app to
link against a D shared library though.

With C, there will need to be defined a common interface header -
similar to what used to be mars.h in rt/ but also contain some useful
runtime functions.


Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list