The globalAlloc(int,int) method of kernel32.dll returns a void pointer. How can i hold that data in java as i need it again in another function?

Davanum Srinivas

One option is to declare a long variable in your java class and use it to store your C++ void * pointer. Use JNI's SetLongField and GetLongField to store and retrieve the data. You will need to type cast the void * to a jlong in your JNI/C++ code.