Linking a DLL to a DLL with packages

Thalamus via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 7 11:29:43 PST 2016


Hi everyone,

First off, I've been working with D for a couple of weeks now and 
I think it's the bee's knees! :) Except for DLLs.

I've been combing through forum posts and Google for this 
situation. Several threads and articles are close but don't quite 
cover what I'm doing here.

On Windows 10, using DMD, I'm creating (currently) six DLLs and 
several EXEs. Some of the DLLs and all of the EXEs are dependent 
on some subset of DLLs. Everything works great if, instead of 
DLLs, I just statically link everything, but that's not really 
what I want to do.

To boil it down, let's say I have a DLL called Extensions, which 
includes a package.d file for its modules with module name 
General. I can successfully build this DLL with the command line:

"dmd dllmain.d module1.d module2.d package.d othermodule.d 
extensions.def -ofExtensions.dll -g -map" and then "implib.exe 
/noi /system Extensions.lib Extensions.dll"

Then, I have a DLL called Platforms. Within is modulea which 
includes a module-scope "import Extensions.General" line. I build 
it with:

"dmd dllmain.d modulea.d moduleb.d package.d othermodulea.d 
platforms.def ..\Extensions\Extensions.lib -ofPlatforms.dll -g 
-map"

(I've tried varying these extensively, including -I paths, 
separating out the compile step from the linking step, and many 
other educated and desperate guesses, with no success.)

So I have a package.d in both DLLs. When I build Platforms, I get:
modulea.d(60): Error: module Extensions.General is in file 
'General.d' which cannot be read.

But of course there is no General.d because the package module 
has to be named package.d. I've tried changing the name and many, 
many other things, but no dice.

Does anyone have other ideas? I'd really rather avoid a single 
giant EXE at the end, if I can.

thanks! :)




More information about the Digitalmars-d-learn mailing list