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

IVF 11.0.074 cannot link to external dll

Silvia_Cagnone
Beginner
510 Views
Dear Forum,

I am having a problem with IVF 11.0.074 pro with IMSL (version with VS2005 included) under Win VISTA Business SP1.

Apparently, it is not possible to link against external dlls.
I have built a dll and a simple main program that calls it:

1. build the dll
ifort try.f90 -dll

2. build the main
ifort main.f90 try.lib

when I launch the main.exe i get the MVSCRT80.dll missing error.
If I put such dll into the working dir I get the following error:
Error R6034: an application has made an attempt to load the C runtime library incorrectly.

Notice the following.
1. I have run try.dll through dependency walker. There are dependencies upon other system's dll (IExplorer dlls as well!)
but if I put in such dlls I get the same error.
2. Of course, if I include the subroutines into the main everything is fine.
3. I have installed the following:
VS 2005 Premier partner edition SP1
VS 2005 SP1 Update for VISTA
MS SDK 6.1 for WIndows server 2008
MS Visual C++ 2008 redistributable kit

I looked at previous threads but could not find something relevant.
At this point I have no more clues, maybe I am missing something fundamental.
any help would be greatly appreciated.

Thank you

Silvia
0 Kudos
5 Replies
Steven_L_Intel1
Employee
510 Views
You need the MSVC 2005 redistributable kit. Remove the DLLs you added manually.
0 Kudos
Silvia_Cagnone
Beginner
510 Views
You need the MSVC 2005 redistributable kit. Remove the DLLs you added manually.

Dear Steve,

thank you for your help,
I have installed both the MSVC 2005 and the 2008 redistributable kit SP1 but I get the same error.
Do I have to remove the MSVC 2008 kit first ?

Thank you

Silvia
0 Kudos
Silvia_Cagnone
Beginner
510 Views
You need the MSVC 2005 redistributable kit. Remove the DLLs you added manually.

UPDATE:
if I build the dll through the windows IDE by setting a shared library project then I am able to link to such dll, even through the command line, that is:

ifort main.f90 try.lib
main.exe --> works

Now I need to understand which options are set through the IDE that are not with the command line,
needless to say that any help is much appreciated. Let me also say that I am a little bit disappointed with the time one has to spend to install and configure correctly the IVF.

Thank you
Silvia
0 Kudos
Steven_L_Intel1
Employee
510 Views
I haven't seen this kind of trouble before. The IDE does run the Microsoft Manifest Tool to embed the manifest after the linker runs, but I haven't generally had a problem building from the command line. I would suggest using /libs:dll when building the executable so that the EXE and DLL are using the same libraries.

You should not have to do ANYTHING when running on the same system you built on.
0 Kudos
Silvia_Cagnone
Beginner
510 Views
I haven't seen this kind of trouble before. The IDE does run the Microsoft Manifest Tool to embed the manifest after the linker runs, but I haven't generally had a problem building from the command line. I would suggest using /libs:dll when building the executable so that the EXE and DLL are using the same libraries.

You should not have to do ANYTHING when running on the same system you built on.

Dear Steve,

thank you very much, the inclusion of the switch -libs:dll does the job.

For the sake of completeness, my problem was not linking to a fortran dll from fortran itself but from R.
In order to link to a IVF dll from R I need to specify the -static option otherwise it gives the MSVCR80.dll/R6034 error

ifort try.f90 -dll -static

does the job for me.

Thanks again

Silvia



0 Kudos
Reply