D hates to be dynamic linked

Steve Teale steve.teale at britseyeview.com
Sun Feb 21 06:00:39 PST 2010


On Sun, 21 Feb 2010 14:06:44 +0100, Lutger wrote:

> Justin Johansson wrote:
> 
>> Eldar Insafutdinov wrote:
>>> Steve Teale Wrote:
>>> 
>>>> On Fri, 19 Feb 2010 16:41:20 -0500, g wrote:
>>>>
>>>>
>>>> I tried to get some attention for this problem again a couple of
>>>> weeks ago (see the "special treat" thread), and everyone who replied
>>>> said "yes, we really need this", but Walter does not want to go
>>>> there.
>>>>
>>>>
>>> Is it really true? That's a big shame. Being able to define and use
>>> plugins in a clean cross-platform way is on of the essential features
>>> of big software packages that D aims at to be used in. The solution to
>>> this problem should really be a top priority, at least I have hoped
>>> so.
>> 
>> Yes it is really true.
>> 
>> You would have read of my dyna-link saga four posts above yours and,
>> reiterating, that sadly was the final show-stopper for me to continue
>> to using D.
> 
> At the risk of asking a dumb question, what is the major roadblock? Is
> it in the GC? Does it require changing the runtime only, or is it also
> required to make changes in the compiler (backend)?

I have not got to the bottom of this yet - been doing building work to 
get a house finished that was deemed to have higher priority. Just to 
keep things basic, I did quite a bit of investigation on the creation of 
Linux shared libraries. I could not do it cleanly with either DMD or GDC. 
There's an account of what I tried on the blog section of http://
www.britseyeview.com/GDC-newbie.html.

I think a major stumbling block is that Phobos is not a shared library, 
so the dynamic linking process can't just pull in stuff it needs when 
loading your shared library plugin. In addition though I think there may 
be a problem with the runtime. I had difficulties with a symbol called 
__data_start (or similar). I could see this in the host program, but it 
was not available to the dynamically loaded object. Also it is not 100% 
clear whether DMD can actually generate position independent code.

I had previously tried to simplify DDL to make it at least be able to 
load a single object file, and in Windows, I had limited success, but it 
seemed to me that throwing a lot of effort into the ancient OMF format 
was not the way to go. I have not had time yet to attempt a similar thing 
with ELF.

So there's more than just dynamic loading, the DMD Windows back end is a 
bit of a blast from the past anyway.

I'm sorry this is rather vague, but I'm not just bleating without having 
tried some things.

Steve



More information about the Digitalmars-d mailing list