[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

960105: building netCDF applications on msdos



>From: address@hidden (Jim Hines (awdnsun) 472-6708)
>Organization: University of Nebraska-Lincoln
>Keywords: 199601031952.AA00339 netCDF MSDOS

Jim,

>Still not working....here is the information you asked for.
>_______________________
>the batch file used for compiling
>
>fl /c /AL jim.for
>link /st:10000 /noe /nod jim.obj+jackets.obj+fslen.obj,,,netcdf.lib+xdr.lib+ll
> ibce.lib+llibfore.lib;
>
>______________________
>jackets.lst
>(mine do not have _ncfils!!!!!)

OK, but this is not the problem.

>_ncabor...........jackets           _ncacpy...........jackets
>_ncadel...........jackets           _ncagt............jackets
>_ncagtc...........jackets           _ncainq...........jackets
>_ncanam...........jackets           _ncapt............jackets
>_ncaptc...........jackets           _ncaren...........jackets
>_ncclos...........jackets           _nccre............jackets
>_ncddef...........jackets           _ncdid............jackets
>_ncdinq...........jackets           _ncdren...........jackets
>_ncendf...........jackets           _ncgopt...........jackets
>_ncinq............jackets           _ncopn............jackets
>_ncpopt...........jackets           _ncredf...........jackets
>_ncsfil...........jackets           _ncsnc............jackets
>_nctlen...........jackets           _ncvdef...........jackets
>_ncvg1c...........jackets           _ncvgt............jackets
>_ncvgt1...........jackets           _ncvgtc...........jackets
>_ncvid............jackets           _ncvinq...........jackets
>_ncvp1c...........jackets           _ncvpt............jackets
>_ncvpt1...........jackets           _ncvptc...........jackets
>_ncvren...........jackets           
>
>jackets           Offset: 00000010H  Code and data size: 179dH
>  _ncabor           _ncacpy           _ncadel           _ncagt
>  _ncagtc           _ncainq           _ncanam           _ncapt
>  _ncaptc           _ncaren           _ncclos           _nccre
>  _ncddef           _ncdid            _ncdinq           _ncdren
>  _ncendf           _ncgopt           _ncinq            _ncopn
>  _ncpopt           _ncredf           _ncsfil           _ncsnc
>  _nctlen           _ncvdef           _ncvg1c           _ncvgt
>  _ncvgt1           _ncvgtc           _ncvid            _ncvinq
>  _ncvp1c           _ncvpt            _ncvpt1           _ncvptc
>  _ncvren         

I have included the appropriate "stuff" that you will need to use to compile
and link netCDF applications on MSDOS interspersed with your code.  Please
pay special attention to the syntax of the lines I added/modified.

>___________________________
>jim.for 
>(i was just trying to learn netcdf from  the example in manual)

$include: "msoft.int"

>c   source in jim.for

       PROGRAM JIM
          ^_________ not absolutely 100% needed, but still a good idea

>      INCLUDE 'netcdf.inc'

$include: "netcdf.inc"

>      integer ncid,rcode,lonid,timeid
>      integer rhid,tid,zid,pid
>      real x
>
>      integer rhindx(3)
>      data rhindx /4,2,1/
>
>      x=0.55
>
>      ncid=ncopn('jim.nc',NCWRITE,rcode)
>      write(*,*)"ncid=",ncid,"   rcode=",rcode,x
>
>c  get dimension ID's
>      latid=ncdid(ncid,'lat',rcode)
>      write(*,*)"latid=",latid,"    rcode=",rcode
>
>      lonid=ncdid(ncid,'lon',rcode)
>      write(*,*)"lonid=",lonid,"    rcode=",rcode
>
>      timeid=ncdid(ncid,'time',rcode)
>      write(*,*)"timeid=",timeid,"    rcode=",rcode
>
>c  get variable ID's
>      rhid=ncvid(ncid,'rh',rcode)
>      write(*,*)"rh=",rhid,"    rcode=",rcode
>
>      zid=ncvid(ncid,'z',rcode)
>      write(*,*)"z=",zid,"    rcode=",rcode
>
>      pid=ncvid(ncid,'p',rcode)
>      write(*,*)"p=",pid,"    rcode=",rcode
>
>      tid=ncvid(ncid,'t',rcode)
>      write(*,*)"t=",tid,"    rcode=",rcode
>
>      write(*,*)"enter starting and end"
>      read(*,*)ist,iend
>
>      do 10 i=ist,iend
>      rhindx(3)=i
>      call ncvpt1 (ncid,rhid,rhindx,i,rcode)
> 10   write(*,*)"ncvpt1    rcode=",rcode,i
>
>      do 20 i=ist,iend
>      rhindx(3)=i
>      call ncvgt1 (ncid,rhid,rhindx,ix,rcode)
> 20   write(*,*)"ncvgt1    rcode=",rcode,i,ix
>
>
>c  must use ncclos or ncdump does not work properly
>
>      call ncclos(ncid,rcode)
>      write(*,*)"rcode close =",rcode
>
>      stop
>      end

As you can see, I only made three changes:

o the include of msoft.int before the PROGRAM statement.  This file contains
  definitions needed by the Microsoft Fortran compiler so its inclusion is
  not optional.
o added the PROGRAM JIM line (not 100% necessary, but a good idea)
o changed the form of the include line for netcdf.inc

After making these small changes, the program compiles with no problem (you
will get warnings like:

[<moe>-C:\NETCDF23\FORTRAN]fl /c /AL jim.for
Microsoft (R) FORTRAN Optimizing Compiler Version 5.10     
Copyright (c) Microsoft Corp 1982-1991. All rights reserved.
 
jim.for
jim.for(47) : error F3607: NCVPT1 : formal argument INDICES : length mismatch
jim.for(47) : error F3606: NCVPT1 : formal argument VALUE : type mismatch
jim.for(47) : error F3607: NCVPT1 : formal argument VALUE : length mismatch
jim.for(52) : error F3607: NCVGT1 : formal argument INDICES : length mismatch
jim.for(52) : error F3606: NCVGT1 : formal argument VALUE : type mismatch
jim.for(52) : error F3607: NCVGT1 : formal argument VALUE : length mismatch

but errors F3606 and F3607 are actually non-maskable warnings.  You should
ignore "errors" like this.

Not having looked at the netCDF documentation for MSDOS in a long time,
I can't tell you if the inclusion of msoft.int (a file provided in the
FORTRAN\MSOFT subdirectory of the netCDF distribution) is explained 
adequately or not.  The guideline to follow is simple, however:

o as the first line of your Fortran program in MSDOS using the MS Fortran
  and C compilers that you have, include msoft.int; the format for
  Fortran includes is explained in the MS Fortran manual(s)
o include the netcdf.inc file as the first line after the PROGRAM statement

>______________________
>sample c program
>(this program works for me when i compile it)
>
>
>#include "netcdf.h"
>#include "stdio.h"
>
>int
>main() {
>   int ncid;
>   ncid=ncopen("jim.nc",NC_NOWRITE);
>   printf("here %d \n",ncid);
>   ncclose (ncid);
>   return 0;
>}

You do not run into problems here since you are not building an application
where Fortran calls C.  For detailed information on Fortran calling C, etc.
please refer to the Microsoft Fortran Advanced Topics manual.

>___________________
>
>I'm using
>Microsoft Fortran 5.1
>Microsoft C       6.00A
>Microsoft Linker  5.15
>______________________

This is good.

>this is the output from the linker
>Microsoft (R) Segmented-Executable Linker  Version 5.15
>Copyright (C) Microsoft Corp 1984-1991.  All rights reserved.
>
>Temporary file c:\ln018159 has been created.
>
>jim.obj(jim.for) : error L2029: 'NCVGT1' : unresolved external
>jim.obj(jim.for) : error L2029: 'NCOPN' : unresolved external
>jim.obj(jim.for) : error L2029: 'NCVPT1' : unresolved external
>jim.obj(jim.for) : error L2029: 'NCVID' : unresolved external
>jim.obj(jim.for) : error L2029: 'NCCLOS' : unresolved external
>jim.obj(jim.for) : error L2029: 'NCDID' : unresolved external

These were caused by the lack of inclusion of msoft.int

>There were 6 errors detected

Tom Yoksas

>From address@hidden Mon Jan  8 08:27:28 1996
>Its working!!
>Thanks for all the help.  Jim Hines