33 messages in net.java.dev.jna.usersRe: [jna-users] Linux SIGSEGV under J...
FromSent OnAttachments
Mark ClickJun 4, 2009 4:59 pm.txt
Timothy WallJun 4, 2009 6:47 pm 
Mark ClickJun 4, 2009 8:50 pm 
Timothy WallJun 5, 2009 4:12 am 
Mark ClickJun 5, 2009 11:10 am 
Timothy WallJun 5, 2009 11:30 am 
Mark ClickJun 5, 2009 1:27 pm 
Timothy WallJun 5, 2009 1:41 pm 
Mark ClickJun 5, 2009 1:54 pm 
Timothy WallJun 5, 2009 3:21 pm 
Mark ClickJun 5, 2009 3:24 pm 
Timothy WallJun 5, 2009 3:28 pm 
Mark ClickJun 5, 2009 3:45 pm 
Mark ClickJun 5, 2009 4:36 pm 
Timothy WallJun 5, 2009 5:02 pm 
Mark ClickJun 7, 2009 3:55 pm 
Timothy WallJun 7, 2009 5:30 pm 
Mark ClickJun 8, 2009 9:22 am 
Mark ClickJun 8, 2009 1:46 pm 
Timothy WallJun 8, 2009 2:13 pm 
Timothy WallJun 8, 2009 2:16 pm 
Mark ClickJun 8, 2009 3:07 pm 
Mark ClickJun 8, 2009 3:08 pm 
Timothy WallJun 8, 2009 3:33 pm 
Timothy WallJun 9, 2009 5:18 am 
Timothy WallJun 9, 2009 6:13 am 
Timothy WallJun 9, 2009 7:08 am 
Mark ClickJun 9, 2009 9:54 am 
Mark ClickJun 9, 2009 10:04 am 
Mark ClickJun 9, 2009 10:07 am 
Mark ClickJun 9, 2009 10:09 am 
Mark ClickJun 9, 2009 2:05 pm 
Mark ClickJun 10, 2009 1:46 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Linux SIGSEGV under JNA but not C?Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Jun 4, 2009 6:47:35 pm
List:net.java.dev.jna.users

If you're running with jna.protected=true, you'll need to preload libjsig.so, e.g.

LD_PRELOAD=/path/to/libjsig.so java {java program args}

You have a single entry point, SWIrecInit(), which presumably expects a wchar_t* argument. On linux, wchar_t is 4 bytes by default, although you should check your library's documentation since it's possible to force a difference size. If it's expecting a char* argument and the windows version expecting wchar_t*, then you'll need to optionally use a type mapper on the windows version.

Apparently your third-party library could do more thorough error checking, since it looks like it's dereferencing a NULL pointer.

Given the simple entry point, the problem is more likely environmental than anything to do with the JNA mapping itself (assuming the mapping is correct -- you didn't provide a C prototype). LD_LIBRARY_PATH will likely be different between a C program and a java program (java adjusts the value and may fork a new process to ensure the path includes its own paths).

On Jun 4, 2009, at 8:00 PM, Mark Click wrote:

Hello!

I have a puzzling problem I'm hoping someone can help with! I've searched the archives and the googles but no luck.

I'm working with a set of commercial libraries in both Windows and Linux. I have a C test program and Java/JNA test program. Both work in Windows, but only the C test program works in Linux. The JNA code works _great_ in Windows, but it SIGSEGVs in Linux, in the native code. Everything else about the two installations is otherwise identical as far as I can tell, and we've tried a fair amount of obvious things (permissions, paths, etc) that are usually cause cross platform problems. It's so puzzling that the C test program works in Linux, but JNA accessing the same libraries doesn't.

If you want more detail, I've attached a dump of the crash. If you have any ideas, no matter how far fetched, I'd love to hear them!

- Mark < dump .txt

To unsubscribe, e-mail: user@jna.dev.java.net For additional commands, e-mail: user@jna.dev.java.net