|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
c++.windows.32-bits - Problem using the DLL
This has me stumped - my DLL compiles fine (thanks to this newsgroup and docs
on the DM site) but the test program for it won't link, giving me "Symbol
Undefined":
testapp1.obj(testapp1)
Error 42: Symbol Undefined _DestroyWaveScrawler 4
testapp1.obj(testapp1)
Error 42: Symbol Undefined _WaveScrawler_LoadWaveFile 8
...and a few more...
yet these functions are defined in the DLL and apear in the import library,
though without the " 4" tidbits. i've no idea why the test program wants the DLL
API functions with those tidbits, while the DLL and its .lib don't provide them.
Relevant simplified toy-version snippets of source follow. I hope it's just
a silly option i'm forgetting, or something "obvious"... well at least i'm the
proud father of a shiny new DLL that seems to be ok, just can't use it!
---begin mydllapi.h ----
#define DLLAPI __declspec(dllimport) __stdcall
extern "C"
BOOL DLLAPI WaveScrawler_Blah(...);
--- end mydllapi.h ---
--- begin mydll.cpp ---
#define DLLAPI __declspec(dllexport) __stdcall
#include "mydllapi.h"
extern "C"
BOOL DLLAPI WaveScrawler_Blah(...)
{...}
--- end mydll.cpp ---
--- begin DLL's makefile ----
.cpp.obj:
dmc -WD -c -g -mn -w- -o $ $<
mydll.dll: mydll.obj $(COREOBJ) coredll.def
dmc mydll.obj $(COREOBJ) coredll.def
mydll.lib: mydll.DLL
implib /noi mydll.lib mydll.DLL
----end makefile ----
--- testapp1.cpp ---
#include <windows.h>
#include "mydllapi.h"
int PASCAL WinMain(HANDLE inst, HANDLE previnst, LPSTR cmd, int nShow)
{
WaveScrawler_Blah(...);
}
--- end testapp1.cpp ---
build testapp1.exe with:
dmc -mn testapp1.cpp mydll.lib
Feb 13 2007
DarenW skrev:This has me stumped - my DLL compiles fine (thanks to this newsgroup and docs on the DM site) but the test program for it won't link, giving me "Symbol Undefined": testapp1.obj(testapp1) Error 42: Symbol Undefined _DestroyWaveScrawler 4 testapp1.obj(testapp1) Error 42: Symbol Undefined _WaveScrawler_LoadWaveFile 8 ...and a few more... yet these functions are defined in the DLL and apear in the import library, though without the " 4" tidbits. i've no idea why the test program wants the DLL API functions with those tidbits, while the DLL and its .lib don't provide them. Relevant simplified toy-version snippets of source follow. I hope it's just a silly option i'm forgetting, or something "obvious"... well at least i'm the proud father of a shiny new DLL that seems to be ok, just can't use it! Feb 13 2007
|