Skip to content

Commit

Permalink
some clarifications on Fortran mangling
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Nov 18, 2014
1 parent 361fe8b commit 045d950
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions doc/manual/calling-c-and-fortran-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ the current process. This form can be used to call C library functions,
functions in the Julia runtime, or functions in an application linked to
Julia.

By default, modern Fortran compilers
`generate mangled names <http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_Fortran>`_
combining the function name with the enclosing module name, separated by underscores.
When calling a Fortran function, all inputs must be passed by reference.
By default, Fortran compilers `generate mangled names
<http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_Fortran>`_
(for example, converting function names to lowercase or uppercase,
often appending an underscore), and so to call a Fortran function via
``ccall`` you must pass the mangled identifier corresponding to the rule
followed by your Fortran compiler. Also, when calling a Fortran
function, all inputs must be passed by reference.

Finally, you can use ``ccall`` to actually generate a call to the
library function. Arguments to ``ccall`` are as follows:
Expand Down

2 comments on commit 045d950

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backported this in 4c56a6b

worth mentioning iso_c_binding at all?

@stevengj
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth a link.

Please sign in to comment.