Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29235 ディスカッション

Dynamic Linking Dll-- File Size is Still Too Big

Ngu_Soon_Hui
ビギナー
1,157件の閲覧回数

I am testing a BLAS example here by trying to create a simple exe with dynamic linking tousing BLAS library. This is my code

program dot_main
real x(10), y(10), sdot, res
integer n, incx, incy, i
external sdot
n = 5
incx = 2
incy = 1
do i = 1, 10
x(i) = 2.0e0
y(i) = 1.0e0
end do
res = sdot (n, x, incx, y, incy)
print*, 'SDOT=',res
end

In order to do sequential, dynamic linking I specify the following in Config Properties->Linker->Input->Additional Dependencies:

mkl_sequential_dll.lib mkl_core_dll.lib mkl_intel_c_dll.lib

The output I produced ("blasexample.exe") is 931 kb, and I can run the exe without all the mkl libraries presented in the exe folder. I think what I did is static linking, not dynamic linking. What did I do wrong?

Edit:

I tried the following command line ( yes, it's command line not through GUI) , the same problem persists:

ifort blasexample.F90 mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib

0 件の賞賛
1 解決策
Steven_L_Intel1
従業員
1,157件の閲覧回数
You need to specify DLL linking to the Fortran run-time DLLs. In the Fortran project properties, select Libraries and set Use Run-Time Library to "Multithreaded DLL".

元の投稿で解決策を見る

4 返答(返信)
Ngu_Soon_Hui
ビギナー
1,157件の閲覧回数

This is my vfproj file:

Steven_L_Intel1
従業員
1,158件の閲覧回数
You need to specify DLL linking to the Fortran run-time DLLs. In the Fortran project properties, select Libraries and set Use Run-Time Library to "Multithreaded DLL".
Ngu_Soon_Hui
ビギナー
1,157件の閲覧回数

Thanks for your suggestion. After I implement it, the size reduce from 0.9 MB to 80kB. So obviously the library is not fully linked in.

However, in theabsenceof the mkl libraries in the same directory as the exe, I expect the exe couldn't run because of missing dependencies. But from what I found this is not so; the exe can still run even though all the mkl libraries are missing. I tested this on the development machine by copied the exe to other directories.

Any ideas?

Steven_L_Intel1
従業員
1,157件の閲覧回数
I don't fully understand the second paragraph. On the development system, the path to the MKL DLLs is added to PATH by the compiler install. If you are going to run the program on a system that does not have Intel Visual Fortran installed, you will need to copy the DLLs used and either put them in the same directory as the EXE or somewhere in PATH. You will also need the Microsoft Visual C++ redistributables, for the same version of Visual Studio you are using, installed on the target system.
返信