Developers

Returning Character Data Types

A discrepancy occurs when working with C and Fortran character strings: C strings are null-terminated while Fortran strings have known lengths. A C routine that returns a character string will be returning a pointer to a null-terminated string. A Fortran routine will not have any knowledge of the string’s length.

ATTRIBUTES

Standard Fortran provides a syntax for interoperating with C, including applying the appropriate naming conventions. You can use BIND(C) for interoperability with C, instead of specifying ATTRIBUTES options.

ALIAS

Use the ALIAS option for the ATTRIBUTES directive If the name of a routine appears as mixed-case in C and you need to preserve the case.

To use the ALIAS option, place the name in quotation marks exactly as it is to appear in the object file.

Subscribe to Developers