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

Reply to Dr. Steve

Zhanghong_T_
Novice
450 Views

I am sorry that I can't reply to the original post.

The interface of 'writestring' is as follows:

  subroutine writestring(filename,msg) bind(c,name='writestring')
  use iso_c_binding
  implicit none
  type(c_ptr),value::filename,msg
  end subroutine

After I replaced 'C_LOC' by 'LOC', the following error displayed:

 

So I think it can't be replaced.

error #6633: The type of the actual argument differs from the type of the dummy argument.   [LOC]	

Thanks,

Tang Laoya

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
424 Views

The type returned by LOC is integer of size of 4 or 8 depending on 32 or 64 bit build

Whereas the type returned by C_LOC is C_PTR.

You have to be consistent with regards to argument type (in INTERFACE and CALL (and receiver function)) even though the bit patters may be the same.

Jim Dempsey

0 Kudos
Steve_Lionel
Honored Contributor III
399 Views

In the interface, replace "type(c_ptr), value" with "character, dimension(*)". In the call, simply remove the C_LOC or LOC.

0 Kudos
Reply