I am compiling several subroutines into 64-bit dll's using Intel Fortran XE 2015, and some of them call IMSL (static library).
I can call these dll's from VBA (Excel add-ins) fine on machines that already have the compiler and IMSL installed. However, when I share the dll's with colleagues, the ones that do not use IMSL work fine, while those calling IMSL routines get the "Run-time error '53' file not found" error.
What am I supposed to do to make my IMSL-based dll's portable to machines that do not have Fortran or IMSL installed?
In case it would shed a light on my problem, here is the Visual Studio setup below:
Fortran command line:
/nologo /O2 /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc120.pdb" /libs:static /threads /c
Linker command line:
/OUT:"x64\Release\FortDLL.dll" /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Release\FortDLL.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:WINDOWS /IMPLIB:"E:\WAKData\Dropbox\FortDLL\FortDLL\x64\Release\FortDLL.lib" /DLL
What you haven't shown is how you specify the set of IMSL libraries to link in. If you are including 'link_fnl_shared', then you'll get the DLL form of IMSL requiring that you redistribute that DLL.
DependencyWalker is useful in seeing which DLLs you are dependent on. Best to use it on the target system - and keep in mind that on a 64-bit system it doesn't understand that Windows skips over "wrong architecture" DLLs in its search.
I'm sorry, here's what I have on my Fortran code:
!DEC$attributes dllexport, alias:'SLOGIT' :: SLOGIT
I thought that by using the static library I would get the called IMSL routines embedded into my dll.
Yes, you would get static IMSL, but I just realized that this would also pull in the OpenMP library which is DLL-only. So you'll need at least libiomp5,dll in PATH.
I did some digging using Dependency Walker and found that the target system did not have libiomp5md.dll.
Once I placed a copy of it in the same foldercontaining my dll's, all my Excel add-ins worked.
Thank you for the tip on Dependency Walker!