Passing a pointer from JNI to Java using a long?

In your example struct myStruct_s mystruct; is a local variable on the stack, and therefore not available after the function returns. Possubly that's just a cut-down of your code, but if not then use a malloc(sizeof(struct myStruct_s)) to get yourself a heap allocation. That then raises the question of when you are going to free that allocation, watch out for memory leaks.

In additiona to @Moise's suggestion I would cast the pointer to a long ratehr than a long * long lp = (long)&myStruct.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions