JuliaLang/julia — Issue #543: Update ccall documentation
Author: ViralBShah
Created: 2012-03-08 04:41:21+00:00
State: open
Labels: documentation

Update ccall documentation to capture the new functionality in commit 2ba6116fc1fdd4616bbfad314f14f16dd087e328

1. Conversions are inserted automatically, so you can simply pass "x,
y, z" instead of the "int32(x), uint64(y), int32(z)" we had to use
everywhere. Of course, this uses the convert() function. Arrays and
byte strings can be converted to pointers.

2. A pointer to a scalar can be passed using the syntax "&x". This is
especially useful for calling fortran. This syntax is a pun and does
not do the same thing as C. In particular, while it is safe for called
functions to write through this pointer, you will not be able to see
its changes (the variable "x" will not change). Things like &0 and
&f(x) also work, since this is not a real address-of operator.
Conversion also happens with &; passing &x as a Ptr{T} will first
convert x to type T.