• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

DLLs the Dynamic Way

Started by Patrice Terrier, May 08, 2013, 07:01:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

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
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

#1
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

Patrice Terrier

#2
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.

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com