Dynamic D Library

BCS ao at pathlink.com
Thu Jul 16 16:23:44 PDT 2009


Reply to Rainer,

> Jarrett Billingsley wrote:
> 
>> ON WINDOWS, DLLs are not allowed to have unresolved externals.  So if
>> you create a DLL in D, yes, Phobos will be linked in.  THERE IS
>> NOTHING THAT CAN BE DONE ABOUT THAT.  It's a limitation on the way
>> DLLs work.
>> 
> In theory, wouldn't it also be possible to solve this problem by
> passing a pointer to the external dependencies into the DLL via an
> initialization function?
> 

With a function resolver to pass in from the host, a whole host of function 
pointers and wrapper functions, I think you could make this work. It would 
be mess to do by hand, but with a tool to muck through the .OBJs (yuck) and 
build the functions... Another option (double yuck) would be to trick the 
linker into running and then build ("self" modifying) code into the DLL that 
somehow knows (another tool and multiple link passes?) where all the fix 
ups are and resolves them on load. (problem: your code can't be read only 
anymore)





More information about the Digitalmars-d mailing list