If I use an extern (C) interface, can I use shared objects in Linux from DMD?

Jacob Carlborg doob at me.com
Sun Dec 4 03:40:44 PST 2011


On 2011-12-02 15:13, Bernard Helyer wrote:
> I don't need to share GC memory across instances or anything,
> but I would be interested in using a C interface if possible.
>
> If not, what's blocking it. If yes, how would one initialise
> the runtime? I know there's a Windows DLL article on the website,
> but I'm interested in Linux.
>
> I know GDC can do it for sure, but I'm interested in DMD's capabilities.
>
>
>
> Thanks,
> -Bernard.

I'm not sure if DMD outputs PIC correctly. This has recently been fixed: 
http://d.puremagic.com/issues/show_bug.cgi?id=4583

Don't know if there's any other problem with PIC. I'm pretty sure that 
compiler needs to be changed to use a different model for TLS. There are 
a couple of different TLS models available. There's one model that works 
anywhere for everything, then there are also models that only works for 
statically linked applications or only for dynamically linked 
applications. I don't know which model DMD uses.

The runtime also needs to be modified to make sure module infos, 
exception handling tables and TLS are implemented correctly.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list