User forums > Help
GetProcAddress problem
MarshMan1101:
Project : DLL Sample
Compiler : GNU GCC Compiler (called directly)
Directory : C:\Program Files\CodeBlocks\Projects\sss\dll\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-gcc.exe -Os -DBUILD_DLL -Os -DBUILD_DLL -I"C:\Program Files\CodeBlocks\include" -c main.c -o .objs\main.o
mingw32-g++.exe -shared -Wl,--dll -L"C:\Program Files\CodeBlocks\lib" .objs\main.o -o loader.dll --export-all-symbols
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
thomas:
Can't see anything wrong :(
mandrav:
--- Quote ---dllInst = LoadLibrary("loader.dll");
--- End quote ---
Maybe it's picking up a loader.dll from somewhere else? Can you try giving there the full path to your loader.dll?
kkez:
Do you compile the file as a C file? If not, are you using "extern "c"" to avoid the c++ name mangling?
--- Code: ---extern "C"
{
DLL_EXPORT LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
// my code here.
}
}
--- End code ---
If this still does not resolve your problem, go look inside the .def file what is the real name for the exported function. In my experience, CALLBACK functions are always exported with "@16 " at the end, for example:
CBTProc exported as CBTProc@16
and so on.
MarshMan1101:
THANK YOU KKEZ!!!
Actually, according to the .def file, it is CBTProc@12. So I called GetProcAddress(dllInst, "CBTProc@12") and everything went perfectly! Thanks again!
Navigation
[0] Message Index
[*] Previous page
Go to full version