This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
FW: Shared Library Help
- From: "Bowyer, Clifton C" <clifton dot c dot bowyer at boeing dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 27 Jul 2005 17:51:22 -0700
- Subject: FW: Shared Library Help
gnu gurus,
I have fallen and can't get up ......
Can you help?
> -----Original Message-----
> From: Bowyer, Clifton C
> Sent: Wednesday, July 27, 2005 5:44 PM
> To: 'Andy Vaught'
> Subject: FW: Shared Library Help
>
> Andy,
>
> Do you have any suggestions or know of someone at the gcc house that
> may be able to help?
>
>
> Thanks again for you help in the past. I really appreciate it.
>
>
> Cliff
>
> -----Original Message-----
> From: Bowyer, Clifton C
> Sent: Wednesday, July 27, 2005 5:39 PM
> To: Laik, Jeffrey E; Moul, Russell G; Walker, Randall S; Barrett,
> Scott A; Drew, Sean M
> Cc: Ingram, Suzanne J; Milsted, Christopher K; Siddons, Dean G;
> Coons, Steven C
> Subject: Shared Library Help
>
> All,
>
> I am attempting to call a fortran subroutine from a java class using
> eclipse and/or the java command on linux.
>
> According to the documentation on the web, the following steps are the
> way to do it.
>
> 1. compile your fortran ....
>
> g95 -c -fPIC -fintrinsic-extensions -fcase-upper -r8 apm_mod.f90
> apmsubs.f90 apmcalc.f90.
>
> 2. with c++, make an external reference to the fortran subroutine to
> be called using JNIEXPORT and JNICALL.
>
> c++ -fPIC -D _FORTRAN_BUILD_ -shared -o libAPMCalcJava.so -L
> /usr/local/g95/lib/gcc-lib/i686-pc-linux-gnu/4.0.0 -l f95 apm_mod.o
> apmsubs.o apmcalc.o APMCalcJava.cpp
>
> 3. run java
>
> Java -classpath classes APMCalc.APMCalcJava
>
> When this is done, I get the error
>
> [bowyerc@cheyenne ~/EA-Proto/APM]$ java -classpath classes
> APMCalc.APMCalcJava
> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> /home/bowyerc/Fortran_Files/APM/libAPMCalcJava.so:
> /home/bowyerc/Fortran_Files/APM/libAPMCalcJava.so: undefined symbol:
> _g95_section_info
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
> at java.lang.Runtime.loadLibrary0(Runtime.java:788)
> at java.lang.System.loadLibrary(System.java:834)
> at APMCalc.APMCalcJava.<clinit>(APMCalcJava.java:79)
>
> The first time I got this error, it was with the symbol
> _g95-nint_2_r8_. This is why I included the -L and -l options in step
> 2. What is even stranger, when you look at the library specified in
> step 2, you do find the _g95_section_info symbol?
>
> Does anyone have any suggestions or know of someone to pass this on
> to?
>
> Any help would be appreciated.
>
> Jeff, Scott, could you pass this on to the rest of the IT group?
>
> Thanks,
>
> Cliff