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

IMSL with old .lib using the cvf interface convention

Loïc_d_Anterroches
504 Views
Hello,

after a lot of reading in this forum I found what my problem is, but I do not have the solution yet. I am using a simulation software which can be extended by creating a Fortran dll extension.dll. To make this dll, I have several dependencies provided by the simulation software in the form of a series of .lib.

1. When I compile everything with the /iface:cvf flag and when I am not using IMSL, everything is working fine.
2. When I make a simple IMSL call to DLSARG with /iface:cvf

USE NUMERICAL_LIBRARIES
...
CALL DLSARG (NDIM, AMAT, NDIM, BMAT, IPATH, XI)

and compile as dll, the compilation goes well but my program crashes when entering DLSARG.

3. When I compile and link IMSL statically, DLSARG is not found. /iface:cvf
4. When I compile and link IMSL with the default iface, then all the routines provided by the simulator's .lib are not found.

So, my question is:

Is it possible with a savant use of the !DEC$ATTRIBUTES to tell the compiler to access DLSARG with the default C interface way while keeping the rest as it is?
Something like:

!DEC$ATTRIBUTES DLLIMPORT :: DLSARG
!DEC$ATTRIBUTES ALIAS : 'DLSARG' :: Z_DLSARG
CALL Z_DLSARG (NDIM, AMAT, NDIM, BMAT, IPATH, XI)

In that case it is not working as I get a:

solver_2d.obj : error LNK2019: unresolved external symbol DLSARG referenced in function _SOLVER_2D

error.

I hope I explained clearly my problem, if not, do not hesitate to ask for clarifications.

Loc
0 Kudos
1 Solution
Steven_L_Intel1
Employee
504 Views
Did you add the lines:

INCLUDE 'link_fnl_static.h'
!DEC$ OBJCOMMENT LIB:'libiomp5md.lib'

to one of your sources? You need this, or need to add the library names explicitly to your link options. My guess is that this is the problem - that you have not told the build to pull in the IMSL libraries.

View solution in original post

0 Kudos
6 Replies
Steven_L_Intel1
Employee
504 Views
Compiler and IMSL version? You should not need to do this, as the IMSL libraries, for quite some time, have added ATTRIBUTES DEFAULT in their modules' interface blocks. It's also possible, though I can't check this until I get into work later, that "DLSARG" is not defined in NUMERICAL_LIBRARIES and you're just getting a default definition. As an experiment, try removing (temporarily) the argument list in the call to DLSARG and see if it compiles. It shouldn't.
0 Kudos
Loïc_d_Anterroches
504 Views
Compiler and IMSL version? You should not need to do this, as the IMSL libraries, for quite some time, have added ATTRIBUTES DEFAULT in their modules' interface blocks. It's also possible, though I can't check this until I get into work later, that "DLSARG" is not defined in NUMERICAL_LIBRARIES and you're just getting a default definition. As an experiment, try removing (temporarily) the argument list in the call to DLSARG and see if it compiles. It shouldn't.

Sorry, I just downloaded and installed all that yesterday from Intel:

Intel Visual Fortran Compiler Integration for Microsoft Visual Studio* 2008, 11.1.3463.2008, Copyright (C) 2002-2009 Intel Corporation

I tried removing the arguments to have only CALL DLSARG and I get:

error #6631: A non-optional actual argument must be present when invoking a procedure with an explicit interface.
etc.. for all the arguments.

Thanks a lot for your speed in answering my question, it is really appreciated!
loc
0 Kudos
Steven_L_Intel1
Employee
504 Views
Ok - that tells me that DLSARG is being found from the module, and I verified that the module uses the DEFAULT attribute. What is the exact and complete text of the link error? And just to verify - you did download and install the 11.1 version of IMSL, and aren't using an old one, right?
0 Kudos
Loïc_d_Anterroches
504 Views
Ok - that tells me that DLSARG is being found from the module, and I verified that the module uses the DEFAULT attribute. What is the exact and complete text of the link error? And just to verify - you did download and install the 11.1 version of IMSL, and aren't using an old one, right?

Sorry for the delay in my answer.

I downloaded the 11.1 version of IMSL (w_cprofimsl_p_11.1.035_ia32.exe) and installed it. Here I try to make a static link.

The linx errors I have are:
solver_2d.obj : error LNK2019: unresolved external symbol _DLSARG referenced in function _SOLVER_2D
solver_2dm.obj : error LNK2001: unresolved external symbol _DLSARG

Here are some of the configurations of my project:
I have the imsl.lib file included explicitely in the project.
In Fortran: /nologo /debug:full /Od /I"......cmns" /I"C:Program FilesVNIimslfnl600IA32includestatic" /warn:nousage /iface:cvf /module:"Debug/" /object:"Debug/" /traceback /check:bounds /libs:dll /threads /c /dll /F6000000
In Linker: /OUT:"C:SIMSCIProii81BinUASLB.dll" /INCREMENTAL /NOLOGO /LIBPATH:"C:Program FilesVNIimslfnl600IA32lib" /DEF:"..UasLB.def" /MANIFEST /MANIFESTFILE:"C:SIMSCIProii81BinUASLB.dll.intermediate.manifest" /DEBUG /PDB:"Debug/UasLB.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"Debug/UasLB.lib" /DLL
In Resources: /fo "Debug/UasLB.res"

If you cannot catch the issue, I can do a full reinstall of Windows XP + Simulation software + Intel Fortran to test again.

Thanks again for your time.
loc

0 Kudos
Steven_L_Intel1
Employee
505 Views
Did you add the lines:

INCLUDE 'link_fnl_static.h'
!DEC$ OBJCOMMENT LIB:'libiomp5md.lib'

to one of your sources? You need this, or need to add the library names explicitly to your link options. My guess is that this is the problem - that you have not told the build to pull in the IMSL libraries.
0 Kudos
Loïc_d_Anterroches
504 Views
Did you add the lines:

INCLUDE 'link_fnl_static.h'
!DEC$ OBJCOMMENT LIB:'libiomp5md.lib'

to one of your sources? You need this, or need to add the library names explicitly to your link options. My guess is that this is the problem - that you have not told the build to pull in the IMSL libraries.

Thanks a lot! You saved my day! Just added it before the "USE NUMERICAL_LIBRARIES" call and it is working perfectly. I even have the maybe subjective feeling that the resulting code is faster than the Compaq version.

Thanks a lot!
loc
0 Kudos
Reply