Current position:  Home > Default > JVM fails

JVM fails

Time:November 30
I'm writing JNI application for some C++ code. I don't have implementations of any functions but I'm pass values of parameters through my java program. e.g. in following OpenDevice function I can pass parallel port parameter(defined in C++) through Java. The implementation is just calling the function. It works.
OpenDevice(DWORD port);
GetImage(BYTE* buffer);
........DWORD and BYTE are defined as unsigned long and unsigned char respectively.
now I want to read 'buffer' but when I try to read the buffer, the JVM fails.
Would any1 help me in above?
The C function takes BYTE*, then the problem can be that you are not handling the Java native stuff correctly. Generally, you must have more C warpper code to create a jbyteArray using NewByteArray() in jni.h and copy data from BYTE buffer to it.
Can you show your Java native method signature?