EDN Admin
Well-known member
Hi,
I am using VC++ 6.0 Standard Edition, trying to call a function from a DLL using the Load Time method. The .exe compiles fine, but it seems that the linker does not see the .lib and gives me the 2001 error. Im guessing it could be an IDE parameter that I have missed. Heres a simplified version of the code:
============ DLL ===================
#include "stdafx.h"
#define dll_entry( type ) extern "C" type __stdcall
dll_entry( int ) run_alert ()
{
return 15;
}
========= .DEF File ===========================
LIBRARY psMyDll
EXPORTS
run_alert
================Executable module ====================
#include "stdafx.h"
//#include "psMyDll.h"
int run_alert(void);
//__declspec(dllimport) int run_alert(void);
int main(int argc, char* argv[])
{
int i = 0;
i = run_alert();
return 0;
}
========= The Link Error ===============================
--------------------Configuration: psCallDll - Win32 Debug--------------------
Linking...
psCallDll.obj : error LNK2001: unresolved external symbol "int __cdecl run_alert(void)" (<a title="mailto:?run_alert@@YAHXZ mailto:?run_alert@@YAHXZ ?run_alert@@YAHXZ )
Debug/psCallDll.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
psCallDll.exe - 2 error(s), 0 warning(s)
In the Settings of the .exe project I include the .lib with the fully qualified path. Any help is greatly appreciated. I did go through a lot of postings but I didnt find anything applicable.
Thanks, Pete.
View the full article
I am using VC++ 6.0 Standard Edition, trying to call a function from a DLL using the Load Time method. The .exe compiles fine, but it seems that the linker does not see the .lib and gives me the 2001 error. Im guessing it could be an IDE parameter that I have missed. Heres a simplified version of the code:
============ DLL ===================
#include "stdafx.h"
#define dll_entry( type ) extern "C" type __stdcall
dll_entry( int ) run_alert ()
{
return 15;
}
========= .DEF File ===========================
LIBRARY psMyDll
EXPORTS
run_alert
================Executable module ====================
#include "stdafx.h"
//#include "psMyDll.h"
int run_alert(void);
//__declspec(dllimport) int run_alert(void);
int main(int argc, char* argv[])
{
int i = 0;
i = run_alert();
return 0;
}
========= The Link Error ===============================
--------------------Configuration: psCallDll - Win32 Debug--------------------
Linking...
psCallDll.obj : error LNK2001: unresolved external symbol "int __cdecl run_alert(void)" (<a title="mailto:?run_alert@@YAHXZ mailto:?run_alert@@YAHXZ ?run_alert@@YAHXZ )
Debug/psCallDll.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
psCallDll.exe - 2 error(s), 0 warning(s)
In the Settings of the .exe project I include the .lib with the fully qualified path. Any help is greatly appreciated. I did go through a lot of postings but I didnt find anything applicable.
Thanks, Pete.
View the full article