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

Issue between getprocaddress and IFX 2026.0?

HenrikS
Novice
216 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

0 Kudos
1 Solution
andrew_4619
Honored Contributor III
187 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

3 Replies
andrew_4619
Honored Contributor III
188 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
68 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
172 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.

Reply