Skip to content

Commit

Permalink
Add note on Fortran name-mangling, fixes #9022
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Nov 15, 2014
1 parent 37ffa13 commit a06e938
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions doc/manual/calling-c-and-fortran-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ 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.

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

Expand Down Expand Up @@ -136,10 +141,9 @@ memory to be passed to the callee and filled in. Allocation of memory
from Julia like this is generally accomplished by creating an
uninitialized array and passing a pointer to its data to the C function.

When calling a Fortran function, all inputs must be passed by reference.

A prefix ``&`` is used to indicate that a pointer to a scalar argument
should be passed instead of the scalar value itself. The following
should be passed instead of the scalar value itself (required for all
Fortran function arguments, as noted above). The following
example computes a dot product using a BLAS function.

::
Expand Down

6 comments on commit a06e938

@ivarne
Copy link
Member

@ivarne ivarne commented on a06e938 Nov 16, 2014

Choose a reason for hiding this comment

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

Is this just as relevant for release-0.3?

In that case @JuliaBackports

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

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

@ihnorton @stevengj this ok to backport?

@ihnorton
Copy link
Member Author

@ihnorton ihnorton commented on a06e938 Nov 19, 2014 via email

Choose a reason for hiding this comment

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

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this was clarified by 045d950 so we'll backport that too

@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 b0977da

@stevengj
Copy link
Member

Choose a reason for hiding this comment

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

@ihnorton, all Fortran compilers name-mangle, because Fortran is case-insensitive.

Please sign in to comment.