tags:

views:

52

answers:

2

I have a dll which has a method for e.g void abc(meth* myMeth) and a structure

struct meth
{
  int a;
  char b[255]; 
} 

The above code code is written in c. I need to map this to Java through JNI, and I am stuck. How can I pass a reference to the method abc as a pointer from a Java method, and how can I set the values of a and b and then pass back to Java again? Need An Urgent Help....Thanks

+1  A: 

There is no mapping between Java classes and C structs (not sure about how JNA handles this); you'll have to create a Java class with the same members as your C struct and write C functions to convert between them.

lhballoti
@lhballoti...i have done with this process and i think it mapped quite well.
java_newbie
+1  A: 

I do not know if this is an option for you, but consider using some higher level framework for managing the low-level details of JNI for you. Two options:

Personally I have used JNAerator and found it really helpful.

Neeme Praks