WRAPIT problems

From: Phil Stauffer <philstau_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 01 2011 - 10:39:37 MDT

Hello NCLers,

I am trying to use WRAPIT to call a fortran subroutine.

First I used the dos2unix command on my file.

When I run: WRAPIT -d writeasi.f

I get:

WRAPIT Version: 091416
OPERATING SYSTEM: Linux
FORTRAN COMPILER (f90c): gfortran
FORTRAN COMPILER OPTIONS (fopts): -fPIC -v -c -fno-second-underscore
A syntax error occurred while parsing:
gcc -fPIC -c -I/opt/local/ncarg/include WRAPIT.c
COMPILING writeasi.f
gfortran -fPIC -v -c -fno-second-underscore writeasi.f
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --disable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)
 /usr/libexec/gcc/i386-redhat-linux/4.1.2/f951 writeasi.f -ffixed-form
-quiet -dumpbase writeasi.f -mtune=generic -auxbase writeasi -version
-fPIC -fno-second-underscore -I
/usr/lib/gcc/i386-redhat-linux/4.1.2/finclude -o /tmp/ccW9Q2yU.s
GNU F95 version 4.1.2 20080704 (Red Hat 4.1.2-51) (i386-redhat-linux)
    compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-51).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 as -V -Qy -o writeasi.o /tmp/ccW9Q2yU.s
GNU assembler version 2.17.50.0.6-14.el5 (i386-redhat-linux) using BFD
version 2.17.50.0.6-14.el5 20061020
SHARED OBJECT NAME (SharedObj): writeasi.so
LINKER SUFFIX (ld_suffix): WRAPIT.o writeasi.o -o writeasi.so
 
LINKING
gcc -fPIC -shared WRAPIT.o writeasi.o -o writeasi.so -lgfortran
END WRAPIT

There is "A syntax error while parsing:" error but the writeasi.so file
is created.

When I try to run the ncl script I get the warning:
warning:Could not find Init() in external file ./writeasi.so, file not
loaded

I ran the command: nm writeasi.so

00001a60 a _DYNAMIC
00001b34 a _GLOBAL_OFFSET_TABLE_
         w _Jv_RegisterClasses
00001a4c d __CTOR_END__
00001a48 d __CTOR_LIST__
00001a54 d __DTOR_END__
00001a50 d __DTOR_LIST__
00000a44 r __FRAME_END__
00001a58 d __JCR_END__
00001a58 d __JCR_LIST__
00001b60 A __bss_start
         w __cxa_finalize@@GLIBC_2.1.3
000009a0 t __do_global_ctors_aux
00000480 t __do_global_dtors_aux
00001a5c d __dso_handle
         w __gmon_start__
00000537 t __i686.get_pc_thunk.bx
00001b60 A _edata
00001b68 A _end
000009d4 T _fini
         U _gfortran_st_close
         U _gfortran_st_open
         U _gfortran_st_write
         U _gfortran_st_write_done
         U _gfortran_transfer_integer
         U _gfortran_transfer_real
0000039c T _init <---------So, init is in the
file, but there is an underscore and it is not capitalized
00000450 t call_gmon_start
00001b64 b completed.5791
00001b60 b dtor_idx.5793
00000500 t frame_dummy
0000053c T writeasi_

Any suggestions on what to do?

NCL version:
 Copyright (C) 1995-2009 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.1.1
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

uname -a
Linux bora.eol.ucar.edu 2.6.18-238.12.1.el5PAE #1 SMP Sat May 7 20:37:06
EDT 2011 i686 i686 i386 GNU/Linux

writeasi.f code:

C NCLFORSTART
      SUBROUTINE writeasi (u,v,nx,ny,nz)
      integer nx,ny,nz,k,j
      real u(nx,ny,nz),v(nx,ny,nz)
C NCLEND

      open(15,FILE="221607-JOSH.asi",STATUS='unknown',FORM='FORMATTED')

      do k = 1, nz

         write(15,17) k
17 format("level",i2)

          do j=1,ny

           write(15,18)j
18 format('azimuth',i3)

           write(15,19) (u(i,j,k),i=1,nx)

           write(15,19) (v(i,j,k),i=1,nx)

19 format(4a2,/,(8E10.3))
         enddo

        enddo

      CLOSE(15)
      RETURN
      END

Thanks,

Phillip
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 1 10:55:44 2011

This archive was generated by hypermail 2.1.8 : Wed Sep 07 2011 - 10:58:58 MDT