Tool for generating JNI Wrapper DLL

Hi,

In my project I need to access methods from third party C++ DLL using JNI.

For that I will have to write a JNI Wrapper DLL.

I am a java programmer and have no idea about C++ programming and creating DLLs.

Is there any tool available that can generate wrapper DLL for me out of that third party DLL?

Thanks

-Pragati

[361 byte] By [pragati_desaia] at [2007-10-3 2:52:31]
# 1
See http://www.simtel.net/product.php[id]93174[SiteID]simtel.net http://www.simtel.net/product.php[id]94368[SiteID]simtel.net
vitallisa at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

Usually we have to write a class which do 4 basic steps.

1> Locate the Dll which consist of function.

2> Load the dll into memory,

3> Load the address of the functions into memory and push all the arguments into stack.

4> Transfer the control to these functions.

try this.... Good Luck....

Guru-1_@raja at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
Yes, it is easy to write JNI code for one or two Java classes. But in my project I use about 100 Java classes. With JNI generator I developed and debugged this project in a week. To write such code by hand I need a number of months.
vitallisa at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
Hi,I am currently working on JNI Implementaion for my project.Iam using VC++ to generate the DLLs. I have nearly 50 java classes to be implemented in JNI. can any one suggest what is the best JNI generator tool that i need to incorporate in to my project.
chatrapathia at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5

With

http://www.simtel.net/product.php[id]93174[SiteID]simtel.net

http://www.simtel.net/product.php[id]94368[SiteID]simtel.net

I developed a project with 140 Java classes. I also built JNI wrappers for all classes in rt.jar (for testing only). The tool above for MS VS6.0 has option to implement Java interface in JNI code for accepting notifications from Java code in JNI. Both tools can filter methods in Java classes to be wrapped in JNI code.

These tool do not use any JVM for generating JNI wrappers. The generation algorithms are based on C++ code made with ANTLR.

vitallisa at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6

Hi

Please help me out to solve the fo0llowing issue:

I am generating the JNI classes without using the tool.And I am using VC++ for generating the DLL.

After generating the header file using javah command i am trying to create a C file implementing the jni methods((ikmp2lib1.c) ) which in turn calls the C functions in the native C file(ikmp_lib).JNI implemented C file (ikmp2lib1.c) is compiled fine but when I tried to generate the DLL it is giving the following errors.

method names in ikmp2lib1.c are like ikmp2lib_IKMP2Obj_IKMPCambioDeClave

project name is ikmp2lib

Linking...

Creating library Debug/ikmp2lib.lib and object Debug/ikmp2lib.exp

ikmp2Lib1.obj : error LNK2001: unresolved external symbol _IKMP_cambio_de_clave

ikmp2Lib1.obj : error LNK2001: unresolved external symbol _IKMP_common_name

ikmp2Lib1.obj : error LNK2001: unresolved external symbol _IKMP_existe_lector

ikmp2Lib1.obj : error LNK2001: unresolved external symbol _IKMP_inserta_tarjeta

etc.

chatrapathia at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 7
Yuh know, piggybacking on someone elses question is not a very good way to get your problem noticed, or to get a response. Especially when your question has nothing to do with the OP.
bschauwejavaa at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 8

Hi

I am working on JNI Implementaion.

Please help me out in generating the DLL file using VC++.

I am able to successfully compile the file and able to generate the lib files but it is not generating the DLL file.

Can you please check this once.

Displaying the following message.

--Configuration: ikmp2lib - Win32 Release--

Compiling...

ikmp2Lib1.c

IKMP_lib.c

Linking...

Microsoft (R) Incremental Linker Version 6.00.8168

Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib D:\DecevalJNI\ikmp2lib\Release\ikmp2Lib1.obj D:\DecevalJNI\ikmp2lib\Release\IKMP_lib.obj D:\DecevalJNI\ikmp2

lib\Release\IKMP_callback.obj c:\forte\install\lib\qqsm.lib c:\forte\install\lib\qqfo.lib c:\forte\install\lib\qqdo.lib c:\forte\install\lib\qqcm.lib c:\forte\install\lib\qqkn.lib kmpapi32.lib OLDNAMES.LIB OLDNAMES.LIB KERNEL32.LIB USER32.LIB GDI32.

LIB WINSPOOL.LIB COMDLG32.LIB SHELL32.LIB WSOCK32.LIB NETAPI32.LIB WINMM.LIB ADVAPI32.LIB

Creating library ikmp2Lib1.lib and object ikmp2Lib1.exp

ikmp2lib.dll - 0 error(s), 0 warning(s)

Thanks and Regards

Chatrapathi

chatrapathia at 2007-7-14 20:41:30 > top of Java-index,Java HotSpot Virtual Machine,Specifications...