How to setup DLL and EXE projects in one VS solution

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 18 01:38:41 PDT 2017


On Thursday, 18 May 2017 at 07:53:02 UTC, Igor wrote:

> I tried just adding import paths to project and to di files and 
> although compilation passes I still get link errors like:
>
> error LNK2019: unresolved external symbol 
> _D10handmade_h10game_input6__initZ 
> (handmade_h.game_input.__init) referenced in function 
> _D8platform5win324main9myWinMainFPvPvPaiZi (int 
> platform.win32.main.myWinMain(void*, void*, char*, int))
>
> where game_input is a struct in interface file. I also tried 
> adding the di file to the exeproject but it still doesn't work. 
> It seems VisualD doesn't add di files to compiler invocation 
> arguments like it does with *.d and *.def files.

.di files don't need to be passed to the compiler. They are 
neither compiled nor linked. The whole point of them is that they 
only provide the declarations, not the implementations. You still 
need to link to a compiled implementation, either in the form of 
an object or library file.

I've never used Visual D (or DMD for that matter) to create a 
DLL, but I assume an import library should have been produced 
along with the DLL. Are you linking to it in your executable 
project?


More information about the Digitalmars-d-learn mailing list