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

How to link ARPACK .lib and .dll files to intel fortran

New Contributor I


I'm trying to use the library ARPACK in the intel visual fortran complier(VS2008). At first, compling of ARPACK using MinGW was successful and I got arpack_x64.dll and arpack_x64.lib (object file library) files. However, now I'm stuck in liking those files to my fortran project.

My ARPACK directory is 'D:\1_STUDY\ARPACK', and following is the procedure that I have made to link the library (actually I'm not sure this is correct).

(1) Linker>Input>Additional Dependencies : D:\1_STUDY\ARPACK\arpack_x64.lib

(2) Tools>Option>Intel(R) Visual Fortran>Compilers:

- Platform-->x64

- Add to Libraries: D:\1_STUDY\ARPACK\arpack_x64.lib

- Add to Includes: D:\1_STUDY\ARPACK\arpack_x64.dll


<Main.f source code>

      integer maxn
      integer maxnev
      integer maxncv
      integer ldv
      INTEGER n
      CHARACTER*2 which ! Hermitian or non-Hermitian
      INTEGER nev ! # of eigvalues to be computed
      DOUBLE PRECISION tol   ! tolerances
      INTEGER ido  ! reverse communication flag
      INTEGER ncv ! # of Lanczos basis vectors to use
      double precision, allocatable :: resid(:)
      integer, allocatable :: workl(:),workd(:),v(:,:)
      maxn = 256
      maxnev = 10
      maxncv = 25
      ldv = maxn
     & ,workd(3*maxn))
      A = 0.D0
      A(1,1) = 10.D0
      A(1,2) = 11.D0
      A(2,1) = 11.D0
      A(2,2) = 20.D0
      PRINT *, A
      which = 'LM'   ! eigvalues largest in magnitude
      bmat = 'I'   ! standard eigvalue problem
      n=2    ! dimension of the problem
      nev = 2  ! # of eigvalues to be computed
      tol = 1.d-10
      IPARAM(1) = 1 ! default exact-shift strategy
      IPARAM(3) = 100   ! max. # of implicit restarts allowed
      IPARAM(7) = 1   ! regular mode
      ido = 0
      ncv = 5  ! at least nev+1 (setting ncv>2*nev is recommended)
      CALL dsaupd(ido,bmat,n,'LM',nev,tol,resid,ncv,v,ldv,iparam
     & ,ipntr,workd,workl,lworkl,info)

<Error messages#1>

LINK : fatal error LNK1181: 'D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib'  (cannot be opened).

So, I added the arpack_x64.lib and arpack_x64.dll files to the same directory with the main.f file. Then, the above error disappeared, but the following error occurred.

<Error messages#2>

1>MAIN.obj : error LNK2019: DSAUPD (unresolved external symbol)

Then, to curcumvent this trouble, I added include 'arpack_x64.lib'  just before the executable section. However, the following error occurred.

<Error messages#3>

1>D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib(2): error #5149: Illegal character in statement label field  [/]
1>D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib(2): error #5078: Unrecognized token '`' skipped
1>D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib(2): error #5082: Syntax error, found INTEGER_CONSTANT '151140550408617' when expecting one of: <END-OF-STATEMENT> ; <LABEL> BLOCK BLOCKDATA PROGRAM MODULE TYPE COMPLEX BYTE ...
1>D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib(2): error #6904: This label has too many digits; a label has a maximum of a 4 digit integer.   [151140550408617]
1>D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib(2): error #6321: An unterminated block exists.
1>D:\1_STUDY\1_MATERIALS\00_ARPACK\test\test\arpack_x64.lib(2): error #6323: This label is not defined in this scoping unit.   [151140550408617]


I want to save the .dll and .lib files to a canonical place and use them instead of copying the files into the local directory every time.

I'm really not sure that the procedure I followed was in right direction since I'm a novice on this library installation.

So any helps or comments are welcome.




0 Kudos
3 Replies
Black Belt Retired Employee

The Tools > Options page you're using isn't for adding specific files to a build, it is where you specify the list of directories the compiler and linker will search. What you want to do instead is add the .lib to the project property Linker > Input > Additional Dependencies. You don't do anything with the DLL when building the application - that is found by Windows when you run the program using its normal rules. (Hint - one usually places the DLL in the same folder as the EXE, or add the directory with the DLL to PATH.)

You certainly should not use an INCLUDE statement to bring in a library!

0 Kudos
Black Belt

The default name mangling of MinGW/GFortran differs from that of IFort. If you use the GFortran defaults, the Arpack DLL (and import library) will have lowercase names for the exported symbols (e.g., dsaupd_ rather than DSAUPD). The convention for adding underscores may also differ. You can fix things up using compiler options or by inserting directives in the source code, either with the GNU tools or with the Intel compiler, but take care to coordinate the two toolchains and make the symbol decorations compatible.

A simpler alternative is to use IFort to compile all the source files in the SRC and UTILS subdirectories of the Arpack distribution (after extracting the main tar file from the Rice University site and then the patch tar file), and combine all the resulting object files into a static library or a DLL.

There is more than one distribution of Arpack. For details and a discussion of some of the issues related to building and using Arpack, see .

0 Kudos

Hi, dimdol10

i am beginner of Fortran90 user.

i am trying to link ARPACK to Visual studio 2010.

But i can't find any hint to making ARPACK. lib and .dll flies.

I spent whole a week. T-T

Could you please share the .lib and .dll files?

thanks you, from Lee


0 Kudos