Thread overview
Shared library question
Jan 22, 2016
Dibyendu Majumdar
Jan 23, 2016
Dibyendu Majumdar
Jan 23, 2016
Benjamin Thaut
January 22, 2016
Hi

I am trying to create a simple shared library that exports a D function, but when I try to link to it I get errors such as:

 error LNK2001: unresolved external symbol _D7xxx12__ModuleInfoZ

Here xxx is the module inside the shared library.

I am using DMD and MS LINKER (Windows 64-bit) to create the DLL / LIB files.
Then I am using DMD to build the executable.

In the test program I do following:

module app;
import xxx;

void main() {
  testing(); /* exported from xxx */
}

I cannot figure out what I am doing wrong - any help appreciated.

Regards
January 23, 2016
On Friday, 22 January 2016 at 22:06:35 UTC, Dibyendu Majumdar wrote:
> Hi
>
> I am trying to create a simple shared library that exports a D function, but when I try to link to it I get errors such as:
>
>  error LNK2001: unresolved external symbol _D7xxx12__ModuleInfoZ
>

I have uploaded my small test here so if anyone can tell me what I am doing wrong it will hugely appreciated.

Thanks!

https://github.com/dibyendumajumdar/d-lab/tree/master/sharedlib
January 23, 2016
On Saturday, 23 January 2016 at 00:38:45 UTC, Dibyendu Majumdar wrote:
> On Friday, 22 January 2016 at 22:06:35 UTC, Dibyendu Majumdar wrote:
>> Hi
>>
>> I am trying to create a simple shared library that exports a D function, but when I try to link to it I get errors such as:
>>
>>  error LNK2001: unresolved external symbol _D7xxx12__ModuleInfoZ
>>
>
> I have uploaded my small test here so if anyone can tell me what I am doing wrong it will hugely appreciated.
>
> Thanks!
>
> https://github.com/dibyendumajumdar/d-lab/tree/master/sharedlib

Dll support on windows is basically non existant at the moment and I strongly advice against trying to use it. Trust me I've been there. I'm currently working on propper Dll support but that is most likely going to take a few more months.

Your best option currently is to simply link everything statically.

Kind Regards
Benjamin