delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/04/21/17:47:50

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199904212142.QAA24776@modi.xraylith.wisc.edu>
X-Authentication-Warning: modi.xraylith.wisc.edu: localhost.xraylith.wisc.edu [127.0.0.1] didn't use HELO protocol
To: John McNally <mcnally AT tempest DOT engr DOT ucdavis DOT edu>
cc: "gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>
Subject: Re: jni,egcs1.1.2 compiling problem
In-reply-to: Your message of "Wed, 21 Apr 1999 14:09:58 PDT."
<371E3EA6 DOT 830EC671 AT tempest DOT engr DOT ucdavis DOT edu>
Date: Wed, 21 Apr 1999 16:42:12 -0500
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>

John McNally <mcnally AT tempest DOT engr DOT ucdavis DOT edu> writes:
> The problem I was having seems to have been solved by using 
> the -jni option on javah.  Sorry, I don't know much about what I'm
> trying to do, so I tend to make a lot of mistakes.

I love problems that solve themselves.

> What is your opinion on the likelihood of success on trying to call a
> FORTRAN subroutine thru jni?
> I know Sun only supports C and C++, but was hoping the integration of
> g77 as a front end to gcc might make it possible.  I am currently
> getting a java.lang.UnSatisfiedLinkError when I call the method.
> Unless I've made some other stupid mistake, I am guessing the symbol
> names in the DLL file are not compatible.
> Do you think I might be able to do something with the dllinit.c (or some
> other foo.c file) as a go-between the java and FORTRAN?
> Or is this out of the league of a neophyte programmer, not prepared to
> do some compiler programming?

One issue here is that you need to compile the F77 functions and
subroutines to use "pascal" calling convention as opposed to the usual
"cdecl" calling conventions (that's what JNICALL expands to). Since
you can't use attributes in f77 code currently, you can just compile
the whole file with -mrtd option to g77 and you should be all set.

The other issue is that since you're not using __declspec(dllexport)
(which is JNICALL expands to), you'll need to manually export the
f77 function/subroutine yourself or use --export-all --add-stdcall-alias
option to dllwrap.

If you send me a simple f77 JNI example, I'll set it up and add it to
the jni-examples package.

Regards,
Mumit

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019