Archived

This topic is now archived and is closed to further replies.

Yohomyth

VC++ DLL problem

Recommended Posts

Yohomyth    108
I''m still having a problem with explicitly linking DLLs. //DLL source: #include <iostream.h> void __declspec(dllexport) abc() { cout << "abc"; } //EXE source #include <windows.h> int main() { HMODULE hDLL = LoadLibrary("dll.dll"); void (*abc)() = GetProcAddress(hDLL,"abc"); abc(); FreeLibrary(hDLL); return 0; } Whenever I try this the program freezes. I debugged it and it turns out that the value of abc is 0x0000. Does anyone know what i''m doing wrong? Here comes the Thnikkaman!

Share this post


Link to post
Share on other sites
SiCrane    11839
Is LoadLibrary() completing succesfully? Try checking the return value. And remember GetLastError() is your friend.

Share this post


Link to post
Share on other sites