Fortran 2008 BIND(C) on internal procedure in Intel Fortran Compiler

ID 659456
Updated 12/27/2018
Version Latest
Public

author-image

By

The Intel® Parallel Studio XE 2017 or later versions for Fortran Windows* and Linux* have a feature enhancement supporting the Fortran 2008 standard BIND(C) on internal procedure.

 

This means you can pass an internal procedure, but not call it directly from outside its host. For example:

program main

   use foo_mod

   call set_func(func)

   contains
      real*8 function func() bind(c)
      func     = 1.0
      end function func

end program main

 

Compile it with an older version of Intel Fortran Compiler there will be an error:

Error #8077: A proc-language-binding-spec shall not be specified for an internal procedure.
      real*8 function func() bind(c)
-----------------------------^

Now with the feature enhancement, it can be accepted by Intel® Fortran compiler 17.0 or later versions.

 

Refer to the Intel® Parallel Studio XE 2019 (or later versions) for Fortran product documentation for additional details.