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

970328: netCDF 2.3.2 Microsoft C++/C7.0 MSDOS problems



>From:    "Hobbs, Chris" <address@hidden>
>Organization: ?
>Keywords:  199703292109.OAA06163 netCDF MSDOS

Chris,

>I am writing to you for help with the net cdf msdos materials I downloaded
>from unidata. I copied the netcdf.lib into my Microsoft FORTRAN v5.1 
>library folder, the netcdf.inc into the include folder, and I dug up a 
>Microsoft C Llibc7.lib and copied it into the library folder.

The MSDOS version of netCDF that is available by anonymous FTP was built
using Microsof Fortran v5.1 and Microsoft C v6.0.  This is pointed out
at the end of pub/netcdf/msdos/README:

"NOTE: These binaries and compiled libraries have been tested with MSDOS 5.0.
They were created using Microsoft C 6.0 and Microsoft Fortran 5.1.  Versions
of Fortran before 5.0 are not compatible with the FSLEN.OBJ function, so the
FORTRAN interface will not work with older version of FORTRAN."

We hinted that there was needed changes for Microsoft C++/C7.0 in:

"Also see the extensive notes on changes recommended to netCDF version 2.3 to
build the library and programs using Microsoft's C++/7.0 compiler without a
coprocessor in the file pub/netcdf/contrib/msoft-7.0.

William A. Spencer supplied some information on how to build netCDF 2.3
using Microsoft C++/C7.0.  His comments can be found in
pub/netcdf/contrib/msoft-7.0.  You might do better to grab the source
for 2.3(.2) and apply the mods that he suggests before proceeding.
We have no way of testing our your problem here since we do not have the

> The line I type after successfully compiling text1.for is:
>
> link /NOE text1.obj+jackets.obj+fslen.obj,,nul,netcdf.lib llibc7.lib;>dump
>
>Some of the text of the dump file is here:
>
>C:\APPS\FORTRAN\LIB\LLIBFOR7.lib(dos\unlink.asm) : error L2025: _remove : 
>symbol defined more than once
>
>text1.obj(text1.for) : error L2029: 'NCINQ' : unresolved external
>netcdf.lib(xdrposix.c) : error L2029: '_read' : unresolved external
>C:\APPS\FORTRAN\LIB\llibc7.lib(dos\crt0.asm) : error L2052: '__edata' : 
>unresolved external; possible calling convention mismatch
>text1.obj(text1.for) : error L2029: 'NCVINQ' : unresolved external
>&etc.
>
>The reason for the /noe was to get rid of a lot of multiply defined errors.
>Here is the program that works on the sample data from unidata's web site:

Where is the specification of the Fortran library on the link line?  An
example link line taken from the netcdf23/fortran/msoft.mk file in the
netCDF distribution for MSDOS (embodied in pub/netcdf/msdos/NETCDF.ZIP) is
given by:

#  Copyright 1993, UCAR/Unidata                                                 
#                                                                               
#  Makefile for netCDF exhaustive test on PS/2                                  
#                                                                               
#  NOTE:  Set the definition of the OS2 macro to match OS as follows:           
#         OS2 = 0     -> DOS                                                    
#         OS2 = 1     -> OS/2                                                   
                                                                                
OS2      = 0                                                                    
                                                                                
CC        = cl                                                                  
CFLAGS    = /c /AL /Za /DMSDOS                                                  
                                                                                
F77       = fl                                                                  
FFLAGS    = /c /AL                                                              
                                                                                
LINK      = link                                                                
LFLAGS    = /st:10000 /nod /noe                                                 
                                                                                
DESTDIR   = C:                                                                  
                                                                                
INCDIR    = ..\libsrc                                                           
INCLUDES  = /I$(INCDIR)                                                         
                                                                                
BINDIR    = $(DESTDIR)\bin                                                      
LIBDIR    = $(DESTDIR)\lib                                                      
CLIB      = llibce.lib                                                          
FORTLIB   = llibfor7.lib                                                        
NETCDFLIB = ..\libsrc\netcdf.lib                                                
!IF $(OS2)                                                                      
OS2LIB    = os2.lib                                                             
!ELSE                                                                           
OS2LIB    =                                                                     
!ENDIF                                                                          
XDRLIB    = ..\xdr\xdr.lib                                                      
LIBS      = $(XDRLIB) $(NETCDFLIB) $(OS2LIB) $(CLIB) $(FORTLIB)                 
                                                                                
.c.obj:                                                                         
        $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $<                              
                                                                                
.for.obj:                                                                       
        $(F77) $(FFLAGS) $(FPPFLAGS) $<                                         
                                                                                
LOADLIBS =                                                                      
                                                                                
GOAL =  ftest.exe                                                               

SRCS =  ftest.for jackets.c                                                     
OBJS =  ftest.obj jackets.obj fslen.obj                                         
                                                                                
all:    $(GOAL)                                                                 
                                                                                
test:   $(GOAL) FORCE                                                           
        $(GOAL)                                                                 
                                                                                
$(GOAL): $(OBJS)                                                                
        $(LINK) $(LFLAGS) $(OBJS),$(GOAL),,$(LIBS);                             
                                                                                
ftest.obj: ftest.for msoft.int netcdf.inc                                       
        $(F77) $(FFLAGS) $(FPPFLAGS) $?                                         
                                                                                
fslen.obj: fslen.asm                                                            


$(GOAL) in this case would be the executable to be produced.  The link
line should expand to:

link /st:10000 /nod /noe ftest.exe jackets.obj 
fslen.obj,ftest.exe,,..\xdr\xdr.lib ..\libsrc\netcdf.lib llibce.lib llibfor7.lib

> INCLUDE 'netcdf.inc'
> CHARACTER*31 VARNAME
> INTEGER I,NCID,NVARS,NATTS,RECDIM,RCODE,VARID,VARTYPE,
>     +  VARDIMS,VARNATT,VARN
>        NCID = ncopn('IMAGE(1).NC',NCNOWRIT,RCODE)
> PRINT *, RCODE
> CALL NCINQ(NCID,NVARS,NATTS,RECDIM,RCODE)
> PRINT *,RCODE
> DO 1 I = 1,NVARS
> VARID = I
> CALL NCVINQ(NCID,VARID,VARNAME,VARTYPE,VARN,VARDIMS,VARNATT,RCODE)
> PRINT *,VARNAME,RCODE
>1       CONTINUE
> CALL NCCLOS(NCID,RCODE)
>        PRINT *,'RCODE =', RCODE
> END

Again, your link line does not include a reference to the Fortran library.
In addition, it may be that your C library wasn't built to include Fortran
compatibility.  On top of all of that, you are using a compiler combination
that we didn't use to build the libraries, and we have been told by
a user that Microsoft C++/C7.0 requires significant changes.

>I would like to use the 3.3 version you have out (or even 2.4), but I may 
>not have the compilers necessary.  The powers that be suggested I go to the
>msdos route to cut teeth.  

Can you dig up Microsoft C 6.0 somewhere?

>Again, I appreciate the answers you've given me 
>in the past and am sorry to burden you with my trivialities.  If you can 
>tell me what library I might be missing, I may be able to find it.  If 
>there is any more info I can provide please tell me.  In a readme you 
>suggested providing the output of some files, but that was for version 2.4.

See above.

> Please let me know if there is something else I can provide.

If you can find the Microsoft C 6.0 compiler, you should be able to
produce code using the netCDF library provided.

>I thank you for any consideration you give this matter and look forward to
>your reply.

Tom Yoksas