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

Published: 06/14/2016  

Last Updated: 12/27/2018

By Xiaoping Duan

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.

 

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.