Linking to netCDF Win32 DLL

Linking to netCDF Win32 DLL

Linking an Intel Fortran V7/Win32 program to the unidata pre-compiled netcdf.dll library (DVF I think) produces unsatisfied externals. Has anyone accomplished this and, if so, what are the steps involved? Is a new build from source necessary or some combination of compiler switches? Thanks for any help.

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

One doesn't link to a DLL - you link to an import library. What are the unsatisfied externals?

Steve

Retired 12/31/2016

On continuing investigation and with help from Intel support, it looks like /Gm solves some or all of the linking problem. I guess it might be better to rebuild the netcdf.dll using the Intel Fortran compiler, but exactly how to do that is still confusing to me, since info on the Unidata site is directed only toward prior versions of compilers and IDEs.

It does appear that, even with /Gm, netcdf calls made exclusively within CONTAINS blocks do not resolve on linking. Calls made earlier in the main subprogram do resolve.

Sorry, of course I meant to say linking to netcdf.lib. Following is the Buildlog.txt relevant output:

Linking...
Link /OUT:"Debug/GMI Stratosphere.exe" /INCREMENTAL /NOLOGO /DEBUG /PDB:"Debug/GMI Stratosphere.pdb" /SUBSYSTEM:CONSOLE netcdf.lib Debug/dlsode.obj Debug/drvr_day.obj Debug/drvr_dlsode.obj Debug/drvr_init.obj Debug/drvr_lookup.obj Debug/drvr_volvo.obj Debug/lookup.obj Debug/
ead_gmi.obj Debug/
ead_ncdf.obj Debug/setkin_kcalc.obj Debug/setkin_lchem.obj Debug/setkin_spcdot.obj Debug/solrpos.obj Debug/write_ncdf.obj
Link: executing 'link'
lookup.obj : error LNK2019: unresolved external symbol _NF_OPEN referenced in function _READ_LOOKUP
read_gmi.obj : error LNK2001: unresolved external symbol _NF_OPEN
read_ncdf.obj : error LNK2001: unresolved external symbol _NF_OPEN
write_ncdf.obj : error LNK2019: unresolved external symbol _NF_OPEN referenced in function _CREATE_NC_OUTPUT
lookup.obj : error LNK2019: unresolved external symbol _NF_INQ_VARID referenced in function _READ_LOOKUP
read_gmi.obj : error LNK2001: unresolved external symbol _NF_INQ_VARID
read_ncdf.obj : error LNK2019: unresolved external symbol _NF_INQ_VARID referenced in function _READ_LOTUS_INPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NF_INQ_VARID referenced in function _CREATE_NC_OUTPUT
lookup.obj : error LNK2019: unresolved external symbol _NF_GET_VAR_REAL referenced in function _READ_LOOKUP
read_gmi.obj : error LNK2001: unresolved external symbol _NF_GET_VAR_REAL
lookup.obj : error LNK2019: unresolved external symbol _NF_CLOSE referenced in function _READ_LOOKUP
read_gmi.obj : error LNK2001: unresolved external symbol _NF_CLOSE
read_ncdf.obj : error LNK2019: unresolved external symbol _NF_CLOSE referenced in function _READ_LOTUS_INPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NF_CLOSE referenced in function _CREATE_NC_OUTPUT
read_gmi.obj : error LNK2019: unresolved external symbol _NF_GET_VAR1_REAL referenced in function _READ_GMI_INPUT
read_gmi.obj : error LNK2019: unresolved external symbol _NF_INQ_DIMID referenced in function _READ_GMI_INPUT._FV_COLUMN
read_ncdf.obj : error LNK2001: unresolved external symbol _NF_INQ_DIMID
read_gmi.obj : error LNK2019: unresolved external symbol _NF_INQ_DIMLEN referenced in function _READ_GMI_INPUT._FV_COLUMN
read_ncdf.obj : error LNK2001: unresolved external symbol _NF_INQ_DIMLEN
read_gmi.obj : error LNK2019: unresolved external symbol _NF_GET_VAR1_INT referenced in function _READ_GMI_INPUT._FV_COLUMN
read_gmi.obj : error LNK2019: unresolved external symbol _NF_GET_VARA_REAL referenced in function _READ_GMI_INPUT._FV_COLUMN
read_ncdf.obj : error LNK2019: unresolved external symbol _NF_GET_VAR_DOUBLE referenced in function _READ_LOTUS_INPUT
read_ncdf.obj : error LNK2019: unresolved external symbol _NF_GET_VAR1_DOUBLE referenced in function _READ_LOTUS_INPUT
read_ncdf.obj : error LNK2019: unresolved external symbol _NF_GET_VARA_DOUBLE referenced in function _READ_LOTUS_INPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCCRE referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _ABORT referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCDDEF referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCVDEF referenced in function _C
REATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCAPTC referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCENDF referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCVPT referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NF_PUT_VAR_REAL referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NCVPTC referenced in function _CREATE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NF_PUT_VAR1_REAL referenced in function _WRITE_NC_OUTPUT
write_ncdf.obj : error LNK2019: unresolved external symbol _NF_PUT_VARA_REAL referenced in function _WRITE_NC_OUTPUT
Debug/GMI Stratosphere.exe : fatal error LNK1120: 23 unresolved externals

Hi,

I don't have the answer to your link problem, but I'm curious as to how useful you would find it if the Array Visualizer supported netCDF. That would allow you to view files using the Array Viewer and also write fortran code such as:

! Open the file
call avOpen("myfile.cdf", 0, status)
! Get extent of first dimension
call avGetExtent("/mydata", 1, nExtent)
! Allocate memory for the array
allocate(myarray(nExtent))
! Read values to the array 
call avReadArray(LOC(myarray), "/mydata", status)

Would you need read/write access or is just read sufficient?

John

Thanks for the response. We tend to use visualization tools developed specifically for our applications (climate/atmospheric chemistry) wrt simulation model output produced on large parallel platforms and visualized locally. I don't think, at first glance, that Array Visualizer support of netCDF would benefit us that much.

My linking question here concerns models compiled and run on my PC/workstation. I used DEC's Array Visualizer more in debugging codes than output analysis.

Ok, thanks for the input.

BTW, We're planning on Intel Fortran to support using AV in debugging for v8.0.

John

Dear Steve,
I would like to implement netCFD in my Fortran programs that I am constructing with Compac Visual Fortran on my Windows XP machine. The netCDF website does not provide instructions for Windows XP. I noticed that you participated in a series of exchanges regarding netCDF last year. Would you have information, or be able to direct me to someone with information, on how I might get netCDF up and running on my system? You help would be greatly appreciated!

Regards,
Elizabeth

Elizabeth,

I'm not specifically familiar with netcdf. John is and he may comment. Windows XP shouldn't be different from any other Windows.

Retired 12/31/2016

I've implemented netCDF support in AV for the upcoming IVF release, but didn't come across any unusual issues building under Windows XP.

John

Leave a Comment

Please sign in to add a comment. Not a member? Join today