3 messages in net.java.dev.jna.users[jna-users] Re: jna and fortran
FromSent OnAttachments
Timothy WallOct 23, 2008 6:46 am 
Timothy WallOct 23, 2008 10:23 am 
Timothy WallNov 3, 2008 12:49 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] Re: jna and fortranActions...
From:Timothy Wall (twal@dev.java.net)
Date:Oct 23, 2008 6:46:50 am
List:net.java.dev.jna.users

What is the output of "nm" against the shared library? That will indicate what the available function names are and whether they're somehow mangled.

I'm not familiar with gfortran shared library output, but assuming the shared library presents a C calling convention (i.e. doesn't need extra linker/compiler magic to allow the C code to call it) then JNA should be able to call it as well.

First try a simple function with no arguments. That'll get the linkage/naming issues out of the way.

On Oct 23, 2008, at 8:42 AM, Kolonay, Raymond M Civ USAF AFMC AFRL/ RBSD wrote:

Dear Mr. Wall, I was given you name by Dr. Mike Sobolewski from Texas Tech University. He thought you may be able to answer my questions concerning the use of JNA and FORTRAN. I have been successful in creating a c shared object and calling it from java using jna. But when I try and create a fortran shared object and call it from java I get an “UnsatisfiedLinkError: Error looking up function” at run time when I try and call the function. I was able to take that fortran shared object, declare it external in a c routine and then call the c shared object from java which in turn call the fortran shared object. But I would really like to be able to go directly from java to fortran. Is this possible? I’m running on a linux 64 bit machine the kernel version is 2.6.18-33.el5. I have four processors – all x86_64. I’m running Red Hat linux 4.1.2-14. The versions of the compilers I’m using are gcc version 4.1.2, gfortran version 4.1.2. The compiler and link flags that I’m using are gcc –c –fPIC gfortran -c -fPIC to create the shared library I’m using the command gcc –shared *.o –o libavus_kriging.so

Any help in this matter would be greatly appreciated.

Regards Ray Kolonay Raymond M. Kolonay Ph.D. Principal Aerospace Engineer AFRL/RBSD 2130 8th Street Suite 1 Bldg 146, Room 218 WPAFB, OH 45433 Phone: (937) 255-6686 fax: (937) 656-6321 email: Raym@wpafb.af.mil