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

Problem loading fortran dll library

Anonymous
Not applicable
595 Views

I switched from VS2015 with integrated "parallel_studio_xe_2017_update2_composer_edition_for_fortran" to VS2022 with integrated
"intel-fortran-compiler-2025.0.4.19" over a mixed language solution, where I call a fortran function from a C++ application in the form of a dll library. The migration of the solution from the original platform to the new platform was successful, in the properties settings of the fortran projects
I only replaced IFORT with IFX. The new solution was successfully built, but the application failed to load the new compiled fortran dll libraries, but the old fortran dll libraries compiled on the previous platform loaded successfully. At experimentation, I found that if I reduce the code size of the newly compiled fortran dll library sufficiently, the library will load. Is this a bug in the new development environment or a setting in the project properties? Or is the freely downloadable version of fortran compiler is limited by code length?

Labels (1)
0 Kudos
1 Solution
Anonymous
Not applicable
300 Views

Thank you, your message led me to a solution to the problem. I used the dependency walker program and it occurred to me to copy the necessary dll libraries marked in it from the installation directory of the fortran compiler to the directory of the running application.

View solution in original post

0 Kudos
7 Replies
andrew_4619
Honored Contributor III
540 Views

There are no limits because it is free. It is the full product. You have some other problem. 

What fails, is it the load library call? What is the error message if you ask for it?

0 Kudos
Anonymous
Not applicable
521 Views

sample of c++ code of loading the library Diagnose.dll:

 

hDllDiagnose = LoadLibrary("Diagnose.dll");
if (!hDllDiagnose)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf,
0,
NULL);
CString log;
log.Format("Load error 'Diagnose.dll': %s", lpMsgBuf);
log.TrimRight('\r');
Log(log, true);
LocalFree(lpMsgBuf);
}
else
pfDiagnose = (TDiagnose)GetProcAddress(hDllDiagnose, "Diagnose");

 

C++ application reports when it starts: " Load error 'Diagnose.dll': module not found " and "Error GetProcAddress (Diagnose) ",

the same old dll library (compiled using an older version of the fortran compiler) loads without a problem ...

0 Kudos
andrew_4619
Honored Contributor III
495 Views

Tried testing the dll using the full path in the name string?

0 Kudos
Steve_Lionel
Honored Contributor III
482 Views

The "module not found" error is misleading - more often this happens because the DLL you are loading depends on some other DLL that cannot be found using the paths Windows uses. The most common reason for this is that the DLL was built as a Debug configuration, and the dependent DLLs are not available outside of the Visual Studio environment.  Make sure that you have selected a Release configuration for the DLL build. If that doesn't fix it, ask again here.

0 Kudos
Anonymous
Not applicable
442 Views

The DLL was built in Release-x64 configuration and the application was run on a system with VS2022 installed. When a sufficient part of the code is removed (it doesn't matter which, i.e. it doesn't matter whether a specific part is removed, the removed part contains only internal code without calling any external functions), the DLL is loaded. The complete original DLL built in an older development environment (VS2015 and fortran 2017) on another computer is also loaded.

0 Kudos
Steve_Lionel
Honored Contributor III
426 Views

The "external functions" is the key. I suggest using the Dependencies app to analyze the DLL and see what it's looking for.

Anonymous
Not applicable
301 Views

Thank you, your message led me to a solution to the problem. I used the dependency walker program and it occurred to me to copy the necessary dll libraries marked in it from the installation directory of the fortran compiler to the directory of the running application.

0 Kudos
Reply