Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Ankündigungen
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Diskussionen

Problem loading fortran dll library

Anonymous
Nicht anwendbar
1.996Aufrufe

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?

Beschriftungen (1)
0 Kudos
1 Lösung
Anonymous
Nicht anwendbar
1.701Aufrufe

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.

Lösung in ursprünglichem Beitrag anzeigen

7 Antworten
andrew_4619
Geehrter Beitragender III
1.941Aufrufe

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?

Anonymous
Nicht anwendbar
1.922Aufrufe

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 ...

andrew_4619
Geehrter Beitragender III
1.896Aufrufe

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

Steve_Lionel
Geehrter Beitragender III
1.883Aufrufe

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.

Anonymous
Nicht anwendbar
1.843Aufrufe

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.

Steve_Lionel
Geehrter Beitragender III
1.827Aufrufe

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

Anonymous
Nicht anwendbar
1.702Aufrufe

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.

Antworten