Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29275 Discussions

error when link NetCDF library for IVF9.1.032

yhmwhigg
Beginner
898 Views

Dear Steve,

For IVF9.1.028 the NetCDF library works well. But when I update IVF to 9.1.032, itdoes not work with NetCDF. There are errors like:

error LNK2019: unresolved external symbol _NF_OPEN referenced in ...

The NetCDF library include static lib and DLL which are for the use of CVF. I modified the interface so the IVF can use it as CVF tradition. My modify like:

integer nf_open
! (character*(*) path,
! integer mode,
! integer ncid)
!DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG, DECORATE, ALIAS:'NF_OPEN' :: NF_OPEN
external nf_open

I add the line !DEC$ ... :: NF_OPEN, so IVF9.1.028 works fine, but why now IVF9.1.032 does not work?

Any suggestions please?

Thanks in advance.

0 Kudos
4 Replies
Steven_L_Intel1
Employee
898 Views

I can't tell what is wrong from the information you have provided. The only thing that comes to mind is to ask if this is a .f90 or .f source file. If the latter, the directive may be too long for fixed-form source. You can split it into two !DEC$ ATTRIBUTES directives if you need to:

!DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG :: NF_OPEN
!DEC$ ATTRIBUTES DECORATE, ALIAS:"NF_OPEN" :: NF_OPEN

I'd go further and recommend replacing the code you show with an interface block as follows:

interface
function NF_OPEN (path, mode, ncid)
!DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG :: NF_OPEN
!DEC$ ATTRIBUTES DECORATE, ALIAS:"NF_OPEN" :: NF_OPEN
integer NF_OPEN
character(*) path
integer mode
integer ncid
end function NF_OPEN
end interface

If this does not help, please submit an example to Intel Premier Support.

0 Kudos
yhmwhigg
Beginner
898 Views

Hi, Steve,

Your suggestion is right. I rewrite the interface your recommend and now it works ok.

The compiler may be changed some things so that the newer version check the program more strictly. The new compiler needclear interface whilethe older one do not.

Thanks again!

Merry Christmas and Happy New Year!

0 Kudos
tropfen
New Contributor I
898 Views
Hello

I have a few questions about your implemetation of netcdf.

Which release number of netcdf is it?
Are you using the lib or the dll of netcdf?
Is your IVF based on MS Windows?
Is your IVF based on VS2005 or VS2003?

Could you attach a sample workspace to your reply?

Thanks in advance.

Frank


0 Kudos
yhmwhigg
Beginner
898 Views

Hi, Frank,

The NetCDF version is 3.6.1 Beta for Win32 which is built by myself in Windows 2000.

Though there are static lib,I think the dll works fine.

My IVF based on Microsoft Visual Studio .NET 2003

I only rewrite the "netcdf.inc" file.

The prebuilt NetCDF 3.6.1 Beta version for CVF and IVF can be download from :

http://yhmyhm.googlepages.com/FORTRAN.htm

Good luck!

0 Kudos
Reply