public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Calling JVM from cygwin
@ 2001-11-01  9:53 Ignasi Villagrasa
  2001-11-02  8:39 ` David A. Cobb
  2001-11-11  8:26 ` Ignasi Villagrasa
  0 siblings, 2 replies; 5+ messages in thread
From: Ignasi Villagrasa @ 2001-11-01  9:53 UTC (permalink / raw)
  To: cygwin

I'd like to call JVM from C native call using Cygnus compiler.

I work in W2000 enviroment using GCC Cygnus compiler.

I followed JNI instructions.

I read in Java forums there was a change in JDK, and instead of  
attaching javai.dll, jvm.dll had to be attached.

Then I made a test using invoke.c example from JDK.

I built following .bat file:
gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32
DLLTOOL --dllname jvm.dll --def libjvm.def --output-lib 
d:\jdk1.3.1\jre\bin\classic\libjvm.a
c++ -o invoke.exe invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm


with libjvm.def :

EXPORTS
_imp__JNI_GetDefaultJavaVMInitArgs@4
_imp__JNI_CreateJavaVM@12


All seems to work fine, and invoke.exe is generated. But when trying to 
run it, I get a windows message telling me :

invoke.exe doesn't find the entry point to _imp__JNI_CreateJavaVM@12 in 
jvm.dll.

What am I going wrong ?

Any calling convention issue ?

I have seen several messages about JNI linking, and tried some changes 
in .def calls with no results.

Is there anyone having the same problem ?

Thanks in advance. Ignasi Villagrasa.





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling JVM from cygwin
  2001-11-01  9:53 Calling JVM from cygwin Ignasi Villagrasa
@ 2001-11-02  8:39 ` David A. Cobb
  2001-11-11  8:26   ` David A. Cobb
  2001-11-11  8:26 ` Ignasi Villagrasa
  1 sibling, 1 reply; 5+ messages in thread
From: David A. Cobb @ 2001-11-02  8:39 UTC (permalink / raw)
  To: Ignasi Villagrasa; +Cc: cygwin

Fool, rushing in where angels fear . . . .

Ignasi Villagrasa wrote:

> I'd like to call JVM from C native call using Cygnus compiler.
> 
> I work in W2000 enviroment using GCC Cygnus compiler.
> 
> I followed JNI instructions.
> 
> I read in Java forums there was a change in JDK, and instead of  
> attaching javai.dll, jvm.dll had to be attached.
> 
> Then I made a test using invoke.c example from JDK.
> 
> I built following .bat file:
> gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32
> DLLTOOL --dllname jvm.dll --def libjvm.def --output-lib 
> d:\jdk1.3.1\jre\bin\classic\libjvm.a
> c++ -o invoke.exe invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm
> 


Umm, are you /really/ invoking *Cygwin* tools with Windows paths?  Or 
are you using the Mingw32 GCC that might be expected to understand 
"d:\jdk1.3.1\include"?

Also, last I heard, the Cygwin port of GCC didn't implement any support 
for the Java library - if that's relevant.

Or, maybe, I'm out of date :-).


> 
> with libjvm.def :
> 
> EXPORTS
> _imp__JNI_GetDefaultJavaVMInitArgs@4
> _imp__JNI_CreateJavaVM@12
> 
> 
> All seems to work fine, and invoke.exe is generated. But when trying to 
> run it, I get a windows message telling me :
> 
> invoke.exe doesn't find the entry point to _imp__JNI_CreateJavaVM@12 in 
> jvm.dll.
> 
> What am I going wrong ?
> 
> Any calling convention issue ?
> 
> I have seen several messages about JNI linking, and tried some changes 
> in .def calls with no results.
> 
> Is there anyone having the same problem ?
> 
> Thanks in advance. Ignasi Villagrasa.
> 
> 
> 
> 
> 
> -- 
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 


-- 
David A. Cobb, Software Engineer, Public Access Advocate, All around 
nice guy.
New PGP key 09/13/2001:
:<http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=superbiskit&\
fingerprint=on>
:<http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=superbiskit&\
fingerprint=on>
Fingerprint=0x{E7C6_4EE2_6B75_5BA3_C52E__77FA_63C3_9366_DCFB_229B}
"By God's Grace I am a Christian man, by my actions a great sinner."
--The Way of a Pilgrim, R. M. French [tr.]
Potentially Viral Software is any software for which you are not allowed
to examine the source.  Do not buy or use Potentially Viral Software!


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Calling JVM from cygwin
  2001-11-01  9:53 Calling JVM from cygwin Ignasi Villagrasa
  2001-11-02  8:39 ` David A. Cobb
@ 2001-11-11  8:26 ` Ignasi Villagrasa
  1 sibling, 0 replies; 5+ messages in thread
From: Ignasi Villagrasa @ 2001-11-11  8:26 UTC (permalink / raw)
  To: cygwin

I'd like to call JVM from C native call using Cygnus compiler.

I work in W2000 enviroment using GCC Cygnus compiler.

I followed JNI instructions.

I read in Java forums there was a change in JDK, and instead of  
attaching javai.dll, jvm.dll had to be attached.

Then I made a test using invoke.c example from JDK.

I built following .bat file:
gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32
DLLTOOL --dllname jvm.dll --def libjvm.def --output-lib 
d:\jdk1.3.1\jre\bin\classic\libjvm.a
c++ -o invoke.exe invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm


with libjvm.def :

EXPORTS
_imp__JNI_GetDefaultJavaVMInitArgs@4
_imp__JNI_CreateJavaVM@12


All seems to work fine, and invoke.exe is generated. But when trying to 
run it, I get a windows message telling me :

invoke.exe doesn't find the entry point to _imp__JNI_CreateJavaVM@12 in 
jvm.dll.

What am I going wrong ?

Any calling convention issue ?

I have seen several messages about JNI linking, and tried some changes 
in .def calls with no results.

Is there anyone having the same problem ?

Thanks in advance. Ignasi Villagrasa.





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling JVM from cygwin
  2001-11-02  8:39 ` David A. Cobb
@ 2001-11-11  8:26   ` David A. Cobb
  0 siblings, 0 replies; 5+ messages in thread
From: David A. Cobb @ 2001-11-11  8:26 UTC (permalink / raw)
  To: Ignasi Villagrasa; +Cc: cygwin

Fool, rushing in where angels fear . . . .

Ignasi Villagrasa wrote:

> I'd like to call JVM from C native call using Cygnus compiler.
> 
> I work in W2000 enviroment using GCC Cygnus compiler.
> 
> I followed JNI instructions.
> 
> I read in Java forums there was a change in JDK, and instead of  
> attaching javai.dll, jvm.dll had to be attached.
> 
> Then I made a test using invoke.c example from JDK.
> 
> I built following .bat file:
> gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32
> DLLTOOL --dllname jvm.dll --def libjvm.def --output-lib 
> d:\jdk1.3.1\jre\bin\classic\libjvm.a
> c++ -o invoke.exe invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm
> 


Umm, are you /really/ invoking *Cygwin* tools with Windows paths?  Or 
are you using the Mingw32 GCC that might be expected to understand 
"d:\jdk1.3.1\include"?

Also, last I heard, the Cygwin port of GCC didn't implement any support 
for the Java library - if that's relevant.

Or, maybe, I'm out of date :-).


> 
> with libjvm.def :
> 
> EXPORTS
> _imp__JNI_GetDefaultJavaVMInitArgs@4
> _imp__JNI_CreateJavaVM@12
> 
> 
> All seems to work fine, and invoke.exe is generated. But when trying to 
> run it, I get a windows message telling me :
> 
> invoke.exe doesn't find the entry point to _imp__JNI_CreateJavaVM@12 in 
> jvm.dll.
> 
> What am I going wrong ?
> 
> Any calling convention issue ?
> 
> I have seen several messages about JNI linking, and tried some changes 
> in .def calls with no results.
> 
> Is there anyone having the same problem ?
> 
> Thanks in advance. Ignasi Villagrasa.
> 
> 
> 
> 
> 
> -- 
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 


-- 
David A. Cobb, Software Engineer, Public Access Advocate, All around 
nice guy.
New PGP key 09/13/2001:
:<http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=superbiskit&\
fingerprint=on>
:<http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=superbiskit&\
fingerprint=on>
Fingerprint=0x{E7C6_4EE2_6B75_5BA3_C52E__77FA_63C3_9366_DCFB_229B}
"By God's Grace I am a Christian man, by my actions a great sinner."
--The Way of a Pilgrim, R. M. French [tr.]
Potentially Viral Software is any software for which you are not allowed
to examine the source.  Do not buy or use Potentially Viral Software!


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling JVM from cygwin
@ 2002-02-13  8:17 Pasch, Thomas (ACTGRO)
  0 siblings, 0 replies; 5+ messages in thread
From: Pasch, Thomas (ACTGRO) @ 2002-02-13  8:17 UTC (permalink / raw)
  To: 'cygwin@cygwin.com', 'gri@netcom.es'

Some time ago, Ignasi Villagrasa wrote:

> [...]
> I built following .bat file: 
> gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32 DLLTOOL
--dllname jvm.dll --def libjvm.def \
> --output-lib d:\jdk1.3.1\jre\bin\classic\libjvm.a c++ -o invoke.exe
invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm 
>
> with libjvm.def : 
>
> EXPORTS 
> _imp__JNI_GetDefaultJavaVMInitArgs@4 
> _imp__JNI_CreateJavaVM@12 
>
> All seems to work fine, and invoke.exe is generated. But when trying to
run it, I get a windows message telling me : invoke.exe 
> doesn't find the entry point to _imp__JNI_CreateJavaVM@12 in jvm.dll. 
> [...]

Hello, 

you are right, there seems to be problem in invoking java from cygwin
(the other way round works all right). It seem that mingw is doing a 
better job here. 

Perhaps http://www-106.ibm.com/developerworks/java/library/j-jnidebug/
is interesting for all. Code examples are included here as well. I can't 
get invocation.zip to work under cygwin. It compiles all right, but
invoking main.exe will lead to a Segmentation fault.

Anyway, your *def file is wrong. Should be something like:

EXPORTS
JNI_CreateJavaVM
JNI_GetCreatedJavaVMs
JNI_GetDefaultJavaVMInitArgs

Kind regards,

Thomas


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2002-02-13 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-01  9:53 Calling JVM from cygwin Ignasi Villagrasa
2001-11-02  8:39 ` David A. Cobb
2001-11-11  8:26   ` David A. Cobb
2001-11-11  8:26 ` Ignasi Villagrasa
2002-02-13  8:17 Pasch, Thomas (ACTGRO)

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).