How to modify a parameter in C++ passed from java (structure Newbie)
Hi,
I'm a brand new to Java (basically a C+ programmer). I have a C++ DLL that takes a structure as parameter from Java and I want to change (or populate) it in C++ DLL.
Here is what I'm trying...
// Java Code...
publicclass CSMSample
{
publicstaticclass MyDetails
{
String myName;
long myAge;
byte[] myBinaryData;
}
publicnativestaticlong SMGetMyDetails(MyDetails myDetails);
publicstaticvoid main(String[] args)
{
MyDetails myDetails =new MyDetails();
SMGetMyDetails(myDetails);
System.out.println("My Name is " + myDetails.myName +" and I am " + myDetails.myAge +" years old");
}
static
{
try
{
System.loadLibrary("SMSample");//SMSample.DLL
}
catch (Exception e)
{
// Handle exception here ...
}
}
}
// C++ code
JNIEXPORT jlong JNICALL Java_CSMSample_SMGetMyDetails(
JNIEnv* env, jclass, jobject jMyDetails)
{
long error = 0;
// I need to modify jMyDetails here and my Java program should be able to read the changes!
return error;
}
Can someone help me please!?
Thanks in advance,
John.

