dynamic library building and loading

Johannes Pfau nospam at example.com
Mon Oct 1 08:06:56 PDT 2012


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.

So we currently don't link in dmain2.o into the shared library and it
must be included manually when linking an application.
(But dmain2 also contains some stuff that really should be in
libdruntime.so, so this source file should probably be split up at some
time.)


More information about the Digitalmars-d mailing list