Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

64 bit issues #9

Closed
mrcduran opened this issue Jul 8, 2011 · 2 comments
Closed

64 bit issues #9

mrcduran opened this issue Jul 8, 2011 · 2 comments

Comments

@mrcduran
Copy link

mrcduran commented Jul 8, 2011

I have an app that uses JNA to call a couple native libraries on Win32 and Linux 32 platforms. However, I am having trouble running the same code on Win7 64 and Linux 64.

The C++ libraries have been compiled on the 64 bit platforms.

Are there any other tricks needed or pitfalls to be aware of to get running on 64 bit platforms?

Are there any known issues with the garbage collection on the 64 bit platforms? Is there a way to make sure the objects I am sending down to the native code do not get garbage collected until after I leave a particular code block? The reason I ask this is on Linux I can step through via the debugger and everything works properly, but if I just run it crashes. I still need to confirm this is the case in Win7 64.

Also, I'm leaning more to the garbage collection because I do not have any long data types any where either.

Any ideas are welcome.

Thanks!

@twall
Copy link
Contributor

twall commented Jul 11, 2011

The Heisenberg issues are more likely GC-related, but may also depend on the state of the C stack. In most cases, an object explicitly passed down to native code will not be GCd for at least the duration of the call, since a reference to the object will exist until the native function returns.

You need to keep an explicit reference to anything that needs to survive across multiple function calls (e.g. callback objects, Memory, or Structures).

Without the context of the crash, however, it's hard to say anything more specific.

@mrcduran
Copy link
Author

Thanks, I double checked the code and found that there was a structure that had a void* field being declared as an int on the Java side. I changed it to NativeLong and everything worked.

I just missed it when looking through the code to port to 64 bit.

Thanks for your reply though.

mstyura pushed a commit to mstyura/jna that referenced this issue Sep 9, 2024
Motivation:

We should include docker / docker-compose files to build the lib

Modifications:

Add docker / docker-compose files

Result:

Easily be able to build via docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants