Mail Archives: cygwin/2007/05/01/16:24:20
Pete Flugstad wrote:
> But when I add the 3rd party DLL calls back in (and link against the
> link lib),
> everything links OK, but when I try and run it, I get an error from the JVM:
>
> Load Error: myJni.dll: Invalid access to memory location
> java.lang.UnsatisfiedLinkError: myJni.dll: Invalid access to
> memory location
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
> at java.lang.Runtime.loadLibrary0(Runtime.java:822)
> at java.lang.System.loadLibrary(System.java:993)
> at com.test.jniTest.main(miniAce.java:33)
You'll have to run this in a debugger to be sure, but I'd start looking
at calling convention clashes, i.e. stdcall vs cdecl. This should be a
function of the header files and how they declare prototypes.
> I setup the same C code under MSVC and generate with that, and it works
> just fine. In looking at the MSVC generated DLL, I see that it's symbol names
> have an underscore '_' on the front of them, while the GCC -mno-cygwin
> generated ones do not. I don't know that that matters, as when I built without
> the 3rd party DLL, it still works.
The name mangling when using stdcall is rather confusing, see
<http://wyw.dcweb.cn/stdcall.htm>.
> I realize this may not be the right place for this question - it may
> be more GCC
> related than Cygwin related (especially since I'm using -mno-cygwin),
> but I know the
> guys who did a lot work on LD to make this work are here. I'm maybe hoping
> someone here has seen this before? Alternatively, what is the right
> place for this
> question - the main GCC mailing list? Or maybe it's a Sun/JVM question?
This is not the right list. When using -mno-cygwin you aren't using any
of Cygwin, you're essentially cross compiling to MinGW. So their
mailing list would probably be the right place to ask. The gcc list is
*never* the right place to ask anything relating to debugging program
crashes, unless you can actually identify a specific compiler bug (which
it never is, 99.999% of the time.)
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -