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

IFX DLL compatibility with third-party IFORT 19.0 compiled program (64 bits)

dpettet
Beginner
603 Views

Hello,

I have successfully compiled and linked a Windows 10 DLL with IFX 2024.0, and it is loaded by a third-party 64 bit program compiled with IFORT 19.0.  The new IFX compiled DLL successfully has full access the the module variable and arrays in the IFORT 19 compiled program.

Calls from the DLL also work only if they contain numeric arguments, but not characters strings.  It seems to be a clear pattern and the program crashes when the calls are made.

This naturally leads to questions what convention is being used for the hidden length argument of the character argument with both IFORT 19 and IFX 2024.

        /iface:[no]mixed_str_len_arg

This directive exists in IFORT and is not documented in IFX /help.  When set, the hidden length argument immediately follows the character string argument, otherwise it is appended to the list of call arguments.

IFX 2024.0 accepts this directive and may or may not do anything with it.  I tried combinations with and without the 'no' toggle and the program crashes every time.

Are IFX 2024 and IFORT 19.0 compatible, and am I just not using it right, or is this a deficiency that needs to be fixed?  Alternatively, do I need to download and and install IFORT 19.  I haven't been able to find where to download it from.  We currently have a license for IFORT 15.0.

Thanks.  Dan.

 

0 Kudos
2 Replies
mecej4
Honored Contributor III
579 Views

The reasoning that you applied appears to be sound, but the conclusions are incorrect. Here is a short test that you can do to see why.

Here is a test main program, which we can compile with IFort or Ifx, with or without the /iface:mixed_str_len_arg option.

 

program tmstrarg

   implicit none
   character s4*4, s5*5, s6*6

   s4 = '4abc'
   s5 = '5defg'
   s6 = '6hijkl'
   call sub(s4,s5,s6)

end program

 

Here is the subroutine, which we shall compile using an older Ifort compiler (I used  Version 19.0.5.281) with the /iface:mixed_str_len_arg option:

 

subroutine sub(a,b,c)
   character(len=*),intent(in) :: a,b,c
   print 10,a,len(a),b,len(b),c,len(c)
 10 format(1x,A,I2)
   return
end subroutine

 

 The result that I obtained with this procedure:

 

ifx /Od /MD tmstr.f90 ssub.obj
tmstr.exe

 

is an access violation (the calling conventions are mismatched).

If I repeat, using /iface:mixed_str_len_arg, this time, the output is what we expect:

 

 4abc 4
 5defg 5
 6hijkl 6

 

 

 

Ron_Green
Moderator
551 Views

You may want to contact the 3rd party that supplies the executable and file a bug report with them.  They may know about compatibility with newer versions of ifort and ifx, and should be able to help you debug your specific issue.

0 Kudos
Reply