Re: WRAPIT issue with .F90 files

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 24 2011 - 09:51:33 MST

Hi Walter,

I think maybe a 32/64 issue. I had no issues.

I created a .so using f77 and f90 both with the stub file
you provided.

%> WRAPIT -fPIC -pg walter.ex.stub walter.ex77.f
%> WRAPIT -fPIC -pg walter.ex.stub walter.ex90.f90

The test driver was:

        ;external EX "./walter.ex77.so"
         external EX "./walter.ex90.so"

         begin
           i = 5
           x = 1.3
           print("before i = " + i)
           print("before x = " + x)
           EX:: ex(i,x)
           print("after i = " + i)
           print("after x = " + x)
         end

The output is

(0) before i = 5
(0) before x = 1.3
(0) after i = 10
(0) after x = -11.045
==================================
Note that the f90 version of your code was named: walter.ex90.f90

           SUBROUTINE EX (II,XX)
               INTEGER :: II
               REAL :: XX

               II = II + 5
               XX = XX - 12.345
               RETURN
           END

On 01/24/2011 09:22 AM, Walter Hannah wrote:
> Hi,
>
> When I use WRAPIT on a Fortan 77 file I have no problems, but when I try
> to do it on a Fortran 90 file using the seperate stub file I get this
> output:
>
> /
> > WRAPIT ex.stub ex.F90
>
> WRAPIT Version: 091416
> /opt/pgi/linux86-64/10.5/bin/pgf90
> LINKING
> /usr/bin/ld: WRAPIT.o: relocation R_X86_64_32 against `.rodata.str1.1'
> can not be used when making a shared object; recompile with -fPIC
> WRAPIT.o: could not read symbols: Bad value
> END WRAPIT/
>
>
> When I use the -fPIC option WRAPIT seems to make the shared object ok,
> but then when I run this NCL file:
>
> ex.ncl:
>
> /external EX "./ex.so"
>
> begin
> i = 5
> x = 1.3
> print("before i = " + i)
> print("before x = " + x)
> EX:: ex(i,x)
> print("after i = " + i)
> print("after x = " + x)
> end
>
> /I get this output:
>
> /warning:An error occurred loading the external file ./ex.so, file not
> loaded
> ./ex.so: undefined symbol: ex_
> warning:error at line 1 in file ex.ncl
>
> fatal:syntax error: line 8 in file ex.ncl before or near :
> EX:
> ----^
>
> fatal:error in statement
> fatal:Syntax Error in block, block not executed
> fatal:error at line 11 in file ex.ncl
> /
>
> I'm guessing that this might be a 32-bit vs 64-bit issue, since I'm on a
> 32 bit machine and ssh'ing onto a 64-bit machine. If I use the Fortran
> 77 version that is found on the WRAPIT help page, everything works fine.
> Any ideas why this might be happening?
>
> Here are the Fortran files,
>
> ex.F90:
> /
> SUBROUTINE EX (II,XX)
> INTEGER II
> REAL XX
>
> II = II + 5
> XX = XX - 12.345
> RETURN
> END/
>
>
> ex.stub:
>
> /C NCLFORTSTART
> SUBROUTINE EX (II,XX)
> INTEGER II
> REAL XX
> C NCLEND
>
>
> /Thanks,
> Walter
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 24 09:51:38 2011

This archive was generated by hypermail 2.1.8 : Tue Jan 25 2011 - 14:22:15 MST