Hi!
I could try to explain what I would like to do, but I think a little code would be much easier to understand. So here goes:
C++ class:
Java class:
C++ main:
So i would like to be able to call c++ functions from java and java functions from c++. The reason for all this is that i would like to be able to use Java as a scripting language for my c++ program.
Maybe the java class should not extend the c++ class but have the function available in some other way?
I've read a little about CNI - but it seems that it only enables the calling of java methods from C++, and not the other way around.
So my questing is this: Can the above be done, or should I look into some other solution to the scripting language problem.
Thanks
I could try to explain what I would like to do, but I think a little code would be much easier to understand. So here goes:
C++ class:
Code:
class Cclass
{
void some_C_function(int i)
{
printf("%d\n",i);
}
};
Code:
Class Jclass extends Cclass
{
public void some_Java_function(int i)
{
some_C_function(i);
}
}
Code:
int main()
{
Jclass *j = new Jclass;
j->some_Java_function(5);
return 0;
}
Maybe the java class should not extend the c++ class but have the function available in some other way?
I've read a little about CNI - but it seems that it only enables the calling of java methods from C++, and not the other way around.
So my questing is this: Can the above be done, or should I look into some other solution to the scripting language problem.
Thanks
Comment