From: Faraz on 6 Feb 2010 22:49 Dear Richard, Now I have linked the exact path of the lib, like "D:\Sensor3\MTCSApi.lib" but get the following errors. Linking... sen3.obj : error LNK2001: unresolved external symbol __imp__MTCSInitSystem Debug/Sensor3.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. is there again problem with the paths
From: Richard Heathfield on 7 Feb 2010 04:08 Faraz wrote: > Dear Richard, > > Now I have linked the exact path of the lib, like > "D:\Sensor3\MTCSApi.lib" > > but get the following errors. > > Linking... > sen3.obj : error LNK2001: unresolved external symbol > __imp__MTCSInitSystem > Debug/Sensor3.exe : fatal error LNK1120: 1 unresolved externals > Error executing link.exe. > > is there again problem with the paths No, you're now missing either a function definition or an object definition. You need to identify the object file that defines the object or function named in the error message, and link it to your project. -- Richard Heathfield <http://www.cpax.org.uk> Email: -http://www. +rjh@ "Usenet is a strange place" - dmr 29 July 1999 Sig line vacant - apply within
From: Faraz on 7 Feb 2010 22:37 Dear Richard, I persistently got the same errors using implicit DLL linking even when I changed the compiler settings so what I did was used explicit function call. The following is the code and I am not using any lib or header provided by the vendor. int CallMyDLL(void) { int x; /* get handle to dll */ HINSTANCE hGetProcIDDLL = LoadLibrary("D:\\Sensor8\\Debug\ \MTCSApi.dll"); if (hGetProcIDDLL){ cout<<"Success DLL"; /* get pointer to the function in the dll*/ FARPROC lpfnGetProcessID = GetProcAddress(HMODULE (hGetProcIDDLL),"MTCSSetParameter"); if (lpfnGetProcessID){ cout<<"Success function"; /* Define the Function in the DLL for reuse. This is just prototyping the dll's function. A mock of it. Use "stdcall" for maximum compatibility. */ typedef int (__stdcall * pICFUNC)(int, int, int); pICFUNC MTCSSetParameter; MTCSSetParameter = pICFUNC(lpfnGetProcessID); /* The actual call to the function contained in the dll */ x = MTCSSetParameter(0, 10, 2); } } /* Release the Dll */ FreeLibrary(hGetProcIDDLL); /* The return val from the dll */ return x; } I am calling this function from main. I dont have any sort of errors, but the point is that I am unable to get pointer to the function. I have made a cout check on that by cout<<"Success function";. The DLL gets loaded as I could enter Dll success. Do you think now there is a problem with the DLL file since now its not able to access the functions either. Thanks
From: FrodoH on 8 Feb 2010 00:06 What is the exported symbol name of the function? You can use "dumpbin.exe /exports <DLL_NAME>" or Dependency Walker to interrogate the DLL. This seems like a configuration issue with __stdcall or __cdecl. On Feb 7, 9:37 pm, Faraz <faras...(a)gmail.com> wrote: > Dear Richard, > > I persistently got the same errors using implicit DLL linking even > when I changed the compiler settings so what I did was used explicit > function call. The following is the code and I am not using any lib or > header provided by the vendor. > > int CallMyDLL(void) > { > int x; > /* get handle to dll */ > HINSTANCE hGetProcIDDLL = LoadLibrary("D:\\Sensor8\\Debug\ > \MTCSApi.dll"); > > if (hGetProcIDDLL){ > cout<<"Success DLL"; > /* get pointer to the function in the dll*/ > FARPROC lpfnGetProcessID = GetProcAddress(HMODULE > (hGetProcIDDLL),"MTCSSetParameter"); > > if (lpfnGetProcessID){ > > cout<<"Success function"; > /* > Define the Function in the DLL for reuse. This is just > prototyping the dll's function. > A mock of it. Use "stdcall" for maximum compatibility. > */ > typedef int (__stdcall * pICFUNC)(int, int, int); > > pICFUNC MTCSSetParameter; > MTCSSetParameter = pICFUNC(lpfnGetProcessID); > > /* The actual call to the function contained in the dll */ > x = MTCSSetParameter(0, 10, 2); > } > > } > /* Release the Dll */ > FreeLibrary(hGetProcIDDLL); > > /* The return val from the dll */ > return x; > > } > > I am calling this function from main. I dont have any sort of errors, > but the point is that I am unable to get pointer to the function. I > have made a cout check on that by cout<<"Success function";. The DLL > gets loaded as I could enter Dll success. Do you think now there is a > problem with the DLL file since now its not able to access the > functions either. > > Thanks
From: Ulrich Eckhardt on 8 Feb 2010 06:37 Remove ~120 of quoted text without any reference... Faraz wrote: > just for clarity i am also adding the header file > > #ifdef EXE > #ifdef USB_DLL_EXPORTS > #define USB_DLL_API __declspec(dllexport) __stdcall > #else > #define USB_DLL_API __declspec(dllimport) __stdcall > #endif > #endif I guess (but only the vendor can answer that) that you are supposed to #define EXE in your application's settings... > #ifdef INDEX > #include "MTCSApi_idx.h" > #endif ....maybe define INDEX... > #ifndef OBJECT > #if defined(__cplusplus) > extern "C" { > #endif > #endif ....and not define OBJECT when you are using C++, which I guess you do. Check that your settings match the above. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: temp and preferences paths Next: Creating a Custom Class for a modeless dialog popup |