• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Build a dll for JNI

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am creating a dll which I will use in my JNI program.
The environment is Win2000, VC++6.0 and J2SDK1.4.2_03.

The cl command that I have given include the JDK/include JDK/include/win32
\Microsoft~3\VC98 and the directory that contains the .c , .h .dll and .lib files.

After the cl command I am giving a link command

link /LibPath:E:\Microsoft~3\vc98\lib /LibPath :\programs\j2sdk1.4.2_03\lib\jvm.lib /dll /out:rfid.dll rfidDataManagerImpl.obj

However I always get the error of unresolved external symbol.

Creating library rfid.lib and object rfid.exp
rfidDataManagerImpl.obj : error LNK2001: unresolved external symbol _rfCloseReader
rfidDataManagerImpl.obj : error LNK2001: unresolved external symbol _rfErrMessage
rfidDataManagerImpl.obj : error LNK2001: unresolved external symbol _rfGetLastErrno


I have included jvm.lib in the cl command and also in the directory where the project files are.

I am using a .dll and .lib file which is provided by the hardware vendor

How can I resolve the LNK2001 error?

Thanks in advance,
Ann
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ann,

I would recommend 2 things:
1) Try implementing an "empty" dll for JNI, which will just implement empty functions you need. This will obviously not require the hw vendor library.
2) Try implementing a library/executable with the functions you need, which will know nothing about Java/JNI. This will use the hw vendor lib.

Then you will see which part of the process causes the problem (probably the second one and therefore it has nothing to do with java ;-). When you resolve the problem you can easily put those 2 pieces together.

BTW I can't see that you are linking the hw vendor library to your dll. Couldn't that be the problem?

Hope it helps,
Petr
[ November 02, 2004: Message edited by: Petr Blahos ]
 
Ann Johnson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A million thanks to you for pointing out my mistake....I still can't believe that I have got the dll created finally....

Thanks once again...
 
I do some of my very best work in water. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic