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

Creating a program with a DLL: odd problem with MSVCR90.DLL

Arjen_Markus
Honored Contributor II
723 Views
Hello,

I was experimenting with data in a DLL and ran into an odd problem with MSVCR90.DLL.
Here is my program:

! getdatadll.f90 --

! Get data from a DLL

!
program getdatadll
use datadll
implicit none

call initdata

write(*,*) array
end program getdatadll


and themodulethat is put intoa DLL:
! datadll.f90 --
! Define a module with data - the module is part of a DLL
!
module datadll
implicit none
real, dimension(10) :: array
!dec$ attributes dllexport:: array
contains
subroutine initdata
!dec$ attributes dllexport:: initdata
call random_number( array )
end subroutine initdata
end module datadll

Now I compile the code with the following commands from a DOS-box (I did not want
to set up a solution and project - too much work for this small program):

ifort /dll datadll.f90
ifort getdatadll.f90 datadll.lib

All is successful, but when I run the program it complains about not being able to find
MSVCR90.DLL.

The platform:
- Windows XP
- Intel Fortran, version 11.1
- I started the DOS-box using the Start menu entry "Fortran Build Environment for applications running on IA-32"

If I compile the program using

ifort getdatadll.f90 datadll.f90

the resulting executable works fine - there is no dependency on MSVCR90.DLL then.

Any idea how to solve this? (My system contains at least two versions of said DLL)

Regards,

Arjen

0 Kudos
2 Replies
Stephen_D_Intel
Employee
723 Views
Hi Arjen,

Try this command to build your executable:

ifort /MD getdatadll.f90 datadll.lib

The /MD option tells the linker to search for unresolved references in
a multithreaded, dynamic-link run-time library. It looks like the dll
build is using different library defaults than the executable build.

Regards,
Steve D.
Intel Developer Support


0 Kudos
Arjen_Markus
Honored Contributor II
723 Views

Hi Steve,

yes, that does the trick! I probably should have thought of it myself, but recent, unpleasant experiences with MSVCR90.DLL and its cousins made me think that it had to do with similar nastinesses - rather than these run-time library options.

Regards,

Arjen

0 Kudos
Reply