This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: examples/tutorial on CNI?


Couldnt get right path to post this new question. Thought this could be
relevant....

Hi,
I'm working on a Migration project (Forte to JAVA).

The forte client had a C++ dll which used to call one more FORTE dll for a
complex database calculations.

Now all the forte code  has been migrated to JAVA except this piece of code
where C++ dll calls Forte DLL.


I'm using JNI to call the Java classes from C++. Some of the methods in C++
has the header files where the signature has reference to the Forte Classes
(Which are now Java Classes).

How do I change the header files to include Java classes in the signature?

(I couldnt find a strong reference for this, but i assume that for all the
classes in Java I'll need to create the .h file using javah utility.


Here is the Sample in one of the C++ header files:

	qqhConnectionHandleClass * m_ForteConnHandle; //qqhConnectionHandleClass
was Forte class which is now  a ConnectionHandleClass in Java.


	HWND m_hwndParent;
	int m_autocommit;
	StatementHandle * m_StmtHandles;
....

Almost all the signatures in the header files of C++, have references to
Forte / Java  classes.

Do I need to use javah and create a header file for the classes and then
include in the C++ header file?


In the implementation class (C++) just including jni.h solves my problem as
it is enough to create the jvm and loading classes/ executing methods..


Any help is appreicated.

Newbie in C++ :) 

Thanks,
Swapnil.








Bryce McKinlay wrote:
> 
> Michael Purdy wrote:
> 
>>Are there any tutorials available describing how to take a java class,
compile it to native code, then access it from a java app via CNI?  I have
found good documentation on using natively compiled java classes in C++ via
CNI, but not in java via CNI...  Or, would it be better to use JNI?
>>  
>>
> Are you are trying to create an application that consists of mixed 
> (interpreted) bytecode and native compiled Java? If so, you don't need 
> CNI (or JNI) - these are for interfacing between Java and C/C++ code.
> 
> With GCJ 4.0 you can use the BC-ABI to create a mixed bytecode/native 
> Java application. See this link for some instructions:
> 
> http://gcc.gnu.org/wiki/How%20to%20BC%20compile%20with%20GCJ
> 
> Bryce
> 
> 
> 


-----
Swapnil Kale ï Think before you print
________________________________________
:working:
-- 
View this message in context: http://www.nabble.com/examples-tutorial-on-CNI--tp287698p14416169.html
Sent from the gcc - java mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]