How to setup DLL and EXE projects in one VS solution

Rainer Schuetze via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 18 11:00:02 PDT 2017



On 18.05.2017 09:53, Igor wrote:
> On Thursday, 18 May 2017 at 07:10:54 UTC, Rainer Schuetze wrote:
>>
>> You have to add an import path to the folder with dllproj inside to
>> the project configuration of the exeproject.
>>
>> If you want to limit the imported code to the declarations, you can
>> enable "generate interface headers" and add an import path to these
>> instead.
>>
>> Sharing data or resources between executable and DLL is currently
>> limited to separate ownership as each binary contains its own copy of
>> the runtime. (There is currently work being done to have a shared
>> runtime, though). You might also run into other cross module
>> dependencies...
>
> 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))

That's what I meant with "other cross module dependencies". In this case 
it might work if you export _D10handmade_h10game_input6__initZ from your 
DLL with the help of a def-file, but that's not something that scales well.

This talk will give you some details on the complications involved: 
https://www.youtube.com/watch?v=MQRHxI2SrYM



More information about the Digitalmars-d-learn mailing list