User forums > Using Code::Blocks
[SOLVED] Using a DLL
thomas:
--- Quote from: stahta01 on May 14, 2008, 01:24:04 am ---Edit: But, I just realized he most likely have a header that might need edited by added extern "C".
--- End quote ---
Well, yes :) Somewhere the function must be declared, after all.
TheLastArrived:
Update
@stahta01: DLLX is defined as __stdcall
extern "C": in Dbx32.h added
--- Code: ---#ifdef __cplusplus
extern "C"
{
#endif
.......
#ifdef __cplusplus
}
#endif
--- End code ---
now if I try to build I get
--- Code: ----------------- Build: Debug in DBXProva02 ---------------
Linking executable: bin\Debug\DBXProva02.exe
obj\Debug\DBXProva02Main.o: In function `ZN15DBXProva02Frame9OnNewFileER20wxFileDirPickerEvent':
D:/Sources/SCE/DBX Utilities/DBXProva02/DBXProva02Main.cpp:81: undefined reference to `TOpenDesign@16'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
--- End code ---
The prefixed underscores disappeared and the name more readable but the function is still missing. :(
I tried with all possible combinations of .dll, .lib, lib<>.a w and w/o -U switch in dlltool. No way.
It's not likely I'm using wrong DLL, because it's part of a package with the header file, given with a CD by the vendor.
TheLastArrived:
I've found this article, it seems it could be useful so I'll give it a read.
More news later :wink:
TheLastArrived:
Bingo :D
edit: I'm wrong don't do it... see some posts below
I've replace
--- Code: ---#define DLLX __stdcall
--- End code ---
with
--- Code: ---#define DLLX __cdecl
--- End code ---
in DBx32.h and now I get a beautiful
--- Code: ---Process terminated with status 0 (0 minutes, 26 seconds)
0 errors, 0 warnings
--- End code ---
I hope it'll functions correctly :wink:
Michael:
--- Quote from: TheLastArrived on May 14, 2008, 11:02:46 am ---I've found this article, it seems it could be useful so I'll give it a read.
More news later :wink:
--- End quote ---
Hello,
also this links could be of some interest:
http://www.codeproject.com/KB/cpp/calling_conventions_demystified.aspx
http://www.unixwiz.net/techtips/win32-callconv.html
http://www.programmersheaven.com/2/Calling-conventions
http://www.devnewz.com/devnewz-3-20050125UsingWin32CallingConventions.html
http://blogs.msdn.com/oldnewthing/archive/2004/01/15/58973.aspx
http://en.wikipedia.org/wiki/X86_calling_conventions
Best wishes,
Michael
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version