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

Issue between getprocaddress and IFX 2026.0?

HenrikS
Novice
556 Views

Hello,

I use the Windows function getprocaddress in a FORTRAN test program when calling a FORTRAN dll. The reason for using getprocaddress is that the test program must have 0 beforehand knowledge about the dll, i.e., no DLLIMPORT, no linked in lib-file etc.

When using IFORT 2021.7 getprocaddress returns proper addresses and the test program runs as expected. When I change to IFX 2026.0 getprocaddress returns 0.

Same happens if the dll is built using IFORT and the test program is built using IFX. Dynamic or static linking of the runtime libraries give the same behavior.

Is there an issue between IFX 2026.0 and getprocaddress or am I doing something wrong? Small test solution attached. I hope someone can reproduce it. My Windows 11 Pro is updated and has version 10.0.26200. If anyone can suggest a functioning alternative to getprocaddress given the restrictions set out above that would also be great.

 

vh,

Henrik

1 Solution
andrew_4619
Honored Contributor III
527 Views

I just looked at the intel interfaces in kernel32.f90 and I would expect that "SUB1" will need to be NULL terminated otherwise it may or may not work dependant on what comes next in memory.  You also need to match the case of the function in the DLL I did not try to check that out but a dumpbin on the dll will give the exact names used.

View solution in original post

4 Replies
andrew_4619
Honored Contributor III
528 Views

I just looked at the intel interfaces in kernel32.f90 and I would expect that "SUB1" will need to be NULL terminated otherwise it may or may not work dependant on what comes next in memory.  You also need to match the case of the function in the DLL I did not try to check that out but a dumpbin on the dll will give the exact names used.

HenrikS
Novice
408 Views

Thanks to you and @Steve_Lionel. Appending the null character did the trick. It runs now. I had never figured that out myself.

Steve_Lionel
Honored Contributor III
512 Views

ifort "helpfully" added a NUL character at the end of character literals - as @andrew_4619 says, the API wants a NUL-terminated string. ifx doesn't do this (and it really shouldn't.) Indeed, case is also important.

masonreed11
New Contributor I
331 Views

If the same code works with IFORT but GetProcAddress returns 0 only with IFX 2026.0, it may be an IFX-specific issue. Double-check that LoadLibrary succeeds and the exported function name matches exactly. If everything checks out, I'd report it to Intel with your test project.

0 Kudos
Reply