This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Problem
- From: "Amit M" <amitvmane at gmail dot com>
- To: java at gcc dot gnu dot org
- Date: Wed, 26 Mar 2008 12:25:37 +0530
- Subject: Problem
Hello
Here is My problem,
I am doing My Last year academic project named "j4cpp wrapper" .In
this project, I am generating wrapper to call java .class files from
c++ so that c++ user can just add that wrapper (which will be just a
header file(.h) ) to invoke methods of that java class file. Here I am
using Invocation API's (kind of Reverse JNI ).
Now my current status is as follows :
code for Wrapper generation for basic datatypes (such as
int,char,float ) and arrays are done.
But now i got problem when a java class( having any java class library
object such as Frames etc..in it. ) i dont know how to deal with
it....how to load them so that c++ user can access to those methods ?
here is the structure of wrapper which my application generates :
*wrapper name is same as class file name with .h extension.
(name of file abc.h)
#include "jvm.cpp" // this file does all JVM loading related work.
class abc // same name as java class name(retrieved
using reflection api's )
{
private :
invocation_api invoke; //object used to invoke and load JVM.
public :
abc() {invoke.create_vm();}
void method1(int,int);
}
void abc::method1(int arg1, int arg2)
{
jvalue returnValue;
Invoke.invoke_class("abc", "method1", "(II)V", &returnValue, arg1, arg2);
/* This function resides in jvm.cpp file which is included @top.
This function takes class name, method name, method signature, jvalue
reference variable and arguments if any. Users are not allowed to
change this line. */
// add user code here if he wants...
}
//****************************** MAIN PROBLEM
*****************************************
Now consider a class file in which some method x takes arguments as
Frames object....
then how i shuold call that methods which resides in that class ?
do i have to wrap that library class ? if yes how ?what will be the
structure of that wrapper ?
Any Links , s/w , pdf which can help me to solve problem are most welcome.
Thanks you for valuable time .