This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: JNI call crashes the JVM


On Sat, Nov 06, 2004 at 08:59:37PM -0800, Solly Ezekiel wrote:
>I've searched the archives for an answer to this question without
>success, so maybe this is a new problem after all...
>
>What I'm trying to do: Call gettimeofday() from Java via JNI.
>
>Why I'm doing this: System.currentTimeMillis() isn't accurate enough.
>It appears to have an accuracy of only about 10 ms under XP.  I want 1
>ms accuracy or better, and unfortunately, the various "real-time"
>extensions to Java (like javax.realtime) rely on
>System.currentTimeMills().
>
>What I've tried: I wrote a native Java method, wrote a C++ body that
>calls gettimeofday(), compiled and linked as described at
>http://www.inonit.com/cygwin/jni/helloWorld/, loaded the DLL using
>System.loadLibrary(), and made the call from Java.  I'm using Cygwin
>v1.5.11-1, g++ v3.3.3-3 and Mingw32 v20040810-1.

Quoting from this web page:

"The goal of this walkthrough will be to create a native method which
does not rely on the Cygwin DLL.  (In other words, it will depend only
on the Windows API.)"

It's odd, given that statement that you would be sending email to
the Cygwin mailing list.

>So, that's where I am.  I could delve into the innards of Cygwin to
>figure out what is (or isn't) happening, but I don't really have the
>time to do that.  Has anyone tried to do what I'm doing, and do you
>have any wisdom you can share?  I can't be the first person to have
>tried making calls to the Cygwin DLLs from JNI...  can I?

I know nothing about JNI but, if you are trying to load the cygwin
library dynamically, that won't work.  You can't load the DLL in
this way.  Sorry.

cgf

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]