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: <371E86BD.91C757B9@tempest.engr.ucdavis.edu> Date: Wed, 21 Apr 1999 19:17:33 -0700 From: John McNally X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en Mime-Version: 1.0 To: Mumit Khan , "gnu-win32 AT cygnus DOT com" Subject: Re: jni,egcs1.1.2 compiling problem References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thank you for all your help. Your Fortran JNI example worked fine as delivered. However I tried making the fortran function have an integer in its argument list. If the function does nothing with the integer passed to it it will return ok. If the integer is used in the function, however, the program crashes. This does not appear to be related to JNI, but in calling the Fortran routine from C. I'm sure this sort of thing must have been ironed out long ago, so it is probably the way I'm doing it. I did try compiling with the -mrtd option. I'll try some more tomorrow. f77func.f ************************************************ function f77func (ii) implicit none integer f77func,ii c Note: the following line produces a runtime error as does any c other operation using ii (e.g. ii=ii+1) f77func = ii write (*,*) 'f77func: Returning ',f77func c return end HelloWorldImp.c ********************************************** #include #include #include #include "HelloWorld.h" /* most f77 compilers tack a underscore after the function name. */ #define F77_FUNCTION(f) f##_ extern int F77_FUNCTION(f77func) (int ii); JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld (JNIEnv *env, jobject obj) { char *home; int i=5; printf("Java JNI\n"); home = getenv ("HOME"); printf("HOME = %s\n", (home) ? home : "(NULL)"); printf("f77func returned %d\n", F77_FUNCTION(f77func) (i)); return; } Mumit Khan wrote: > I'm sending an example of f77 code JNI. You'll get a directory named 'f' > when you untar the package (tar zxvf java-jni-f77.tar.gz), and then use > the ``make -f Makefile.cyg'' to build the hello.dll. > > Regards, > Mumit > -- John McNally Graduate Student, UCLA Graduate Student Researcher, UC-Davis e-mail: mcnally AT tempest DOT engr DOT ucdavis DOT edu -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com