I am new to C++,I am creating a dll to use in JAVA.
when i am creating a dll file at compilation i am getting the following error....
Any one please help me in this regard..........
Creating library sparsha_Reader.lib and object sparsha_Reader.exp
sparsha_Reader.obj : error LNK2019: unresolved external symbol "__declspec(dllim
port) void __cdecl ConnectDevice(char *,char *)" (__imp_?ConnectDevice@@YAXPAD0@
Z) referenced in function _Java_sparsha_CardReader_CardReadering@8
sparsha_Reader.obj : error LNK2019: unresolved external symbol "__declspec(dllim
port) void __cdecl DisconnectDevice(char *)" (__imp_?DisconnectDevice@@YAXPAD@Z)
referenced in function _Java_sparsha_CardReader_stopCardReader@8
sparsha_Reader.dll : fatal error LNK1120: 2 unresolved externals
Function exported from Dll, should be defined as __declspec(dllexport). In the client project it should be defined as __declspec(dllimport). This is usually done by defining some precompiler constant in the Dll project, and conditional definition, which is expanded as __declspec(dllexport) in the Dll project, and __declspec(dllimport) in the client project.
To see how it is done, create new Win32 Dll using Visual Studio Application Wizard, and check "Exports symbols" on one of Wizard steps. Created project shows how to export functions and classes from Dll properly.
Such program compiles, but linker gives unresolved external symbol error.
Hi
I am having ICM330_0170DLL.h,ICM330_0170DLL.dll and ICM330_0170DLL.lib files given by my customer now to get a new dll based on these files.I worte a new cpp file as .....
#define NOMINMAX
and compiling this cpp file by using command:
Cl/LD sparsha_Reader.cpp /NXCOMPAT /MACHINE:X86 /LINK "D:\sparsha\new\RamyamICM3301\ICM330-0170DLL\ICM330_0170DLL.lib"
then i am getting this error as described above.
if i compile using command like....
Cl/LD sparsha_Reader.cpp /NXCOMPAT /MACHINE:X86 /LINK "D:\sparsha\new\RamyamICM3301\ICM330-0170DLL\ICM330_0170DLL.dll"
i am getting error ...
D:\sparsha\new\RamyamICM3301\ICM330-0170DLL\ICM330_0170DLL.dll
D:\sparsha\new\RamyamICM3301\ICM330-0170DLL\ICM330_0170DLL.dll : fatal error LNK
1107: invalid or corrupt file: cannot read at 0x2A8
when i am compiling i am getting .obj,.exp,.lib and .dll.manifest files
i am new to cpp so what to do now?
anybody can help me...
Show ConnectDevice and DisonnectDevice definitions from ICM330_0170DLL.h.
Do you have some code samples using this library? Usually library writers provide such samples.
Show ConnectDevice and DisonnectDevice definitions from ICM330_0170DLL.h.
Do you have some code samples using this library? Usually library writers provide such samples.
Hi
The total header file what they provided me is................................
/*
The end of the declaration of return codes for the APIs
--------------------------------------------------------------------------------------------------
*/
they given me one exe file with that device is connecting but i dont know how to see code for that exe file.
if u can help me i will send that exe file also.
Why not go to the Sun website, and try those examples first, before trying to do this yourself with your own code? When I was first getting JNI to work, I went through the simple sample programs first before creating the library that I was working on. If the sample at the link doesn't work for you, then at least everyone here will have some kind of concrete reference point as to what is failing.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; January 4th, 2010 at 11:31 PM.
Reading this h-file, I don't see any reason why this program is not linked. The only strange point is your code:
typedef public char *LPCSTR; // 1byte
typedef char *DWORD; //4bytes
Why do you need the second typedef? Possibly it prevents compiler to create correct external dependency, which should be resolved by linker.
Hi
In actual h-file i don't have typedef's....but when i compile cpp file in which i included these header file i m getting errors so i wrote these typedef's .I don't know how to compile without wrirting these typedef's.
Hello, you sudheerdara locate the libraries. Lib and dll files in C: \ windows \ system32, that if you use visual c + +, plus you do link to. Lib you have
Bookmarks