Powerbasic Museum 2020-B

IT-Consultant: Patrice Terrier => Discussion => Topic started by: Patrice Terrier on May 08, 2013, 07:01:00 PM

Title: DLLs the Dynamic Way
Post by: Patrice Terrier on May 08, 2013, 07:01:00 PM
While searching for a solution to ease the use of my new C/C++ GDImage.dll without using .lib file, i found this MSDN article that describes a macro class that simplifies and automates the dynamic linking of DLLs.

http://msdn.microsoft.com/en-us/library/ms810279.aspx#dlldynamic_pdllclass
Title: Re: DLLs the Dynamic Way
Post by: James C. Fuller on May 08, 2013, 08:09:03 PM
Patrice,
  This works for me with zTrace:
#define C_IMPORT EXTERN_C __declspec(dllimport)
C_IMPORT long __stdcall zTrace (WCHAR*);
#pragma comment(lib,"zTrace.lib")


James
Title: Re: DLLs the Dynamic Way
Post by: Patrice Terrier on May 08, 2013, 08:38:22 PM
That never work by me

It always fails with:
fatal error LNK1104: unable to open the file 'zTrace.lib'

zTrace.lib and zTrace.dll are of course Inside the same folder.

Added:
In order to let it work, i am forced to specify the full path to the .lib file.
There must be an easier way, to just tell the compiler that it should use the same folder than the resulting EXE, or something similar.
When it works it is still a pain, because of course you can't use the same .lib file for 32 and 64-bit, then you have to use some kind of #def, to first select the correct target.