- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have just installed the latest HPC toolkit (intel-oneapi-hpc-toolkit-2025.0.1.48_offline.exe).
C++ main and a Fortran project are shown below.
Test.cpp
#include <iostream>
#include <Windows.h>
int main()
{
HINSTANCE hDLL = LoadLibrary(L"FPROJ.dll");
if (hDLL == NULL)
std::cout << "DLL loading FAIL!" << std::endl;
else
std::cout << "DLL loading SUCCESS!" << std::endl;
}
FPROJ.for
INTEGER*4 FUNCTION MYPROJ(N)
!MS$ ATTRIBUTES DLLEXPORT::MYPROJ
INTEGER*4,ALLOCATABLE::IARR(:)
!ALLOCATE(IARR(2*N)) ! C++ cannot load this DLL if this line is uncommented.
MYPROJ = 1
RETURN
END
The VS 2019 project is shown below.
The FPROJ project creates a FPROJ.dll
- With the FPROJ.for shown above that commented out the ALLOCATE statement, the C++ main loads the FPROJ.dll successfully.
- However, if the ALLOCATE statement is uncommented, the FPROJ.dll cannot be loaded in run time.
I cannot figure out why having the ALLOCATE statement in the Fortran dll function causes the dll loading issue in C++.
Is this a known issue with the latest IFX compiler or does any one experience the same issue?
A complete set of project files is attached if any one wanted try my codes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
You are right on.
I guess the code without the ALLOCATE statements did not need oneapi libraries.
I added the oneAPI\2025.0\bin in the PATH variable then the code with the ALLOCATE statements works.
Thanks a lot.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This usually means that a dependent DLL is not found by Windows. In your case it is almost certainly the Intel Fortran run-time support DLL. My guess, especially if you are running this from inside VS, is that the Intel DLLs have not been added to PATH. Sometimes logging out and in again will fix this (you should need to do this only once.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Thanks for the prompt response.
[A] The same project with just the ALLOCATE statement commented out works perfectly fine.
[B] If the ALLOCATE statement is uncommented, it does NOT work.
If my PATH or other settings are not correct, neither should work. However, [A] works but not [B].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
You are right on.
I guess the code without the ALLOCATE statements did not need oneapi libraries.
I added the oneAPI\2025.0\bin in the PATH variable then the code with the ALLOCATE statements works.
Thanks a lot.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page