www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking a DLL to a DLL with packages

reply Thalamus <norobots foo.com> writes:
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! :)
Jan 07
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
On Thursday, 7 January 2016 at 19:29:43 UTC, Thalamus wrote:
 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.

 thanks! :)
Dlls don't currently work on Windows. The only thing that works is giving your dlls a C-like interface. If you need any kind of D interface (classes, modules, etc) it won't work. I'm currently working on this, if you need it really badly and are willing to help bug testing send me a mail to code at benjamin-thaut.de Kind Regards Benjamin Thaut
Jan 08
next sibling parent reply Thalamus <norobots foo.com> writes:
On Friday, 8 January 2016 at 12:13:15 UTC, Benjamin Thaut wrote:
 On Thursday, 7 January 2016 at 19:29:43 UTC, Thalamus wrote:
 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.

 thanks! :)
Dlls don't currently work on Windows. The only thing that works is giving your dlls a C-like interface. If you need any kind of D interface (classes, modules, etc) it won't work. I'm currently working on this, if you need it really badly and are willing to help bug testing send me a mail to code at benjamin-thaut.de Kind Regards Benjamin Thaut
Hi Benjamin, I wouldn't say I need DLLs to work fully _really_ badly. The only non-negligible issue with single very large binaries that's crossed my mind is patching, but we're years away from having to worry about that too much. That being said, I'm definitely willing to do some testing, especially for something that helps us down the road. I'll follow up with you offline. Thanks!
Jan 09
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 09.01.2016 um 16:45 schrieb Thalamus:
 Hi Benjamin,

 I wouldn't say I need DLLs to work fully _really_ badly. The only
 non-negligible issue with single very large binaries that's crossed my
 mind is patching, but we're years away from having to worry about that
 too much. That being said, I'm definitely willing to do some testing,
 especially for something that helps us down the road. I'll follow up
 with you offline. Thanks!
Great, some help with bugfixing and testing would be greatly apreciated. I didn't get any e-mail from you yet, I assume you didn't send one? Kind Regards Benjamin Thaut
Jan 10
parent Thalamus <norobots foo.com> writes:
On Sunday, 10 January 2016 at 15:58:55 UTC, Benjamin Thaut wrote:
 Am 09.01.2016 um 16:45 schrieb Thalamus:
 Hi Benjamin,

 I wouldn't say I need DLLs to work fully _really_ badly. The 
 only
 non-negligible issue with single very large binaries that's 
 crossed my
 mind is patching, but we're years away from having to worry 
 about that
 too much. That being said, I'm definitely willing to do some 
 testing,
 especially for something that helps us down the road. I'll 
 follow up
 with you offline. Thanks!
Great, some help with bugfixing and testing would be greatly apreciated. I didn't get any e-mail from you yet, I assume you didn't send one? Kind Regards Benjamin Thaut
Hi Benjamin. Sorry for the delay. It's been a very busy week. I just hit Send on a mail to you.
Jan 13
prev sibling parent tcak <1ltkrs+3wyh1ow7kzn1k sharklasers.com> writes:
On Friday, 8 January 2016 at 12:13:15 UTC, Benjamin Thaut wrote:
 On Thursday, 7 January 2016 at 19:29:43 UTC, Thalamus wrote:
 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.

 thanks! :)
Dlls don't currently work on Windows. The only thing that works is giving your dlls a C-like interface. If you need any kind of D interface (classes, modules, etc) it won't work. I'm currently working on this, if you need it really badly and are willing to help bug testing send me a mail to code at benjamin-thaut.de Kind Regards Benjamin Thaut
I thought DLLs (shared library) had problem on *nix, but was fine on Windows. I have never heard there was any problem about it on Windows. --- Check this page. http://wiki.dlang.org/Win32_DLLs_in_D Test the example. If it works, then you can continue modifying it to fit your desired system. But I do not think your problem is about DLL, but you are doing something wrong about module names and file names.
Jan 09