public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Using Cygwin 1 with Mumit's JNI examples
@ 1999-12-03  3:02 Alan Griffiths
  1999-12-03  7:28 ` Mumit Khan
  1999-12-31 13:28 ` Alan Griffiths
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Griffiths @ 1999-12-03  3:02 UTC (permalink / raw)
  To: cygwin

I'm using the Cywin 1.0 CD and have downloaded Mumit's JNI examples,
but I can't get them to work!

What I've done:

/1/ download and unzip java-jni-examples.zip from
    http://www.xraylith.wisc.edu/~khan/software/gnu-win32/

/2/ go to the c++ sub-directory

/3/ copy Makefile.cyg to Makefile

/4/ Add the following lines after the respective defines:
    CPPFLAGS+= -D__int64="long long"
    JDK_ROOT = c:/Java/jdk1.2.2
    DLLWRAP_FLAGS+= --target=cygwin32 	

/5/ type "make". This appears to build the dll successfully.

*But* now when I run the Main application it exits with no apparent
results. So...

/6/ I changed the initialiser in HelloWorld.java to...

    static {
        try
        {
            System.out.println("arg debug: before loadLibrary");
            System.loadLibrary("hello");
        }
        finally
        {
            System.out.println("arg debug: after loadLibrary");
        }
    }

...and discovered that the first println() is executed and the second isn't. 
(If I delete the dll I reach the second println() and have the expected
UnsatisfiedLinkError trace.)

Clearly something is going horribly wrong with loading the dll. But I don't
have the first idea what to look for.  Any suggestions?

PS 
Thanks Mumit for pointing me at the list archive - which had  answers to
some of my earlier difficulties.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Cygwin 1 with Mumit's JNI examples
  1999-12-03  3:02 Using Cygwin 1 with Mumit's JNI examples Alan Griffiths
@ 1999-12-03  7:28 ` Mumit Khan
  1999-12-31 13:28   ` Mumit Khan
  1999-12-31 13:28 ` Alan Griffiths
  1 sibling, 1 reply; 4+ messages in thread
From: Mumit Khan @ 1999-12-03  7:28 UTC (permalink / raw)
  To: Alan Griffiths; +Cc: cygwin, khan

Alan Griffiths <alan.griffiths@experian.com> writes:
> I'm using the Cywin 1.0 CD and have downloaded Mumit's JNI examples,
> but I can't get them to work!

Loading Cygwin DLL from noncygwin apps (such as Java JNI) is broken
in Cygwin v1.0 CD version.

Your best bet is to pick a recent development snapshot and see if
that works. We can take it from there.

The root cause of the breakage is in winsup/entry.cc, where there
is a block in dll_entry() that looks like this:
  
  case DLL_PROCESS_ATTACH:
    if (! static_load)
      {
	/* ... */
      }
    break;

The code between the `if' block screws up dynamic loading of Cygwin DLL
from noncygwin apps.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Using Cygwin 1 with Mumit's JNI examples
  1999-12-03  3:02 Using Cygwin 1 with Mumit's JNI examples Alan Griffiths
  1999-12-03  7:28 ` Mumit Khan
@ 1999-12-31 13:28 ` Alan Griffiths
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Griffiths @ 1999-12-31 13:28 UTC (permalink / raw)
  To: cygwin

I'm using the Cywin 1.0 CD and have downloaded Mumit's JNI examples,
but I can't get them to work!

What I've done:

/1/ download and unzip java-jni-examples.zip from
    http://www.xraylith.wisc.edu/~khan/software/gnu-win32/

/2/ go to the c++ sub-directory

/3/ copy Makefile.cyg to Makefile

/4/ Add the following lines after the respective defines:
    CPPFLAGS+= -D__int64="long long"
    JDK_ROOT = c:/Java/jdk1.2.2
    DLLWRAP_FLAGS+= --target=cygwin32 	

/5/ type "make". This appears to build the dll successfully.

*But* now when I run the Main application it exits with no apparent
results. So...

/6/ I changed the initialiser in HelloWorld.java to...

    static {
        try
        {
            System.out.println("arg debug: before loadLibrary");
            System.loadLibrary("hello");
        }
        finally
        {
            System.out.println("arg debug: after loadLibrary");
        }
    }

...and discovered that the first println() is executed and the second isn't. 
(If I delete the dll I reach the second println() and have the expected
UnsatisfiedLinkError trace.)

Clearly something is going horribly wrong with loading the dll. But I don't
have the first idea what to look for.  Any suggestions?

PS 
Thanks Mumit for pointing me at the list archive - which had  answers to
some of my earlier difficulties.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Cygwin 1 with Mumit's JNI examples
  1999-12-03  7:28 ` Mumit Khan
@ 1999-12-31 13:28   ` Mumit Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Mumit Khan @ 1999-12-31 13:28 UTC (permalink / raw)
  To: Alan Griffiths; +Cc: cygwin, khan

Alan Griffiths <alan.griffiths@experian.com> writes:
> I'm using the Cywin 1.0 CD and have downloaded Mumit's JNI examples,
> but I can't get them to work!

Loading Cygwin DLL from noncygwin apps (such as Java JNI) is broken
in Cygwin v1.0 CD version.

Your best bet is to pick a recent development snapshot and see if
that works. We can take it from there.

The root cause of the breakage is in winsup/entry.cc, where there
is a block in dll_entry() that looks like this:
  
  case DLL_PROCESS_ATTACH:
    if (! static_load)
      {
	/* ... */
      }
    break;

The code between the `if' block screws up dynamic loading of Cygwin DLL
from noncygwin apps.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-31 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-03  3:02 Using Cygwin 1 with Mumit's JNI examples Alan Griffiths
1999-12-03  7:28 ` Mumit Khan
1999-12-31 13:28   ` Mumit Khan
1999-12-31 13:28 ` Alan Griffiths

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).