dynamic library building and loading

Johannes Pfau nospam at example.com
Tue Oct 2 01:11:14 PDT 2012


Am Mon, 01 Oct 2012 19:18:46 +0200
schrieb Jacob Carlborg <doob at me.com>:

> On 2012-10-01 17:06, Johannes Pfau wrote:
> 
> > 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.)
> 
> I'm not sure if I follow this correctly or not, but why is this
> needed to be handled manually? If you pass "-shared" to the compiler
> just skip linking dmain2.o, otherwise link with it. Would that work?
> 

Yes something similar would work, it's just not yet implemented.

GDC should detect if we're linking against a shared druntime and then
it should automatically add dmain2.o to the linker command.


More information about the Digitalmars-d mailing list