Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cfunction tuple of types deprecation #23066

Merged
merged 3 commits into from
Aug 23, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update docs
  • Loading branch information
musm committed Aug 22, 2017
commit 782da87acc1af57739b63a31eb4a133d9b796ac2
6 changes: 3 additions & 3 deletions doc/src/manual/calling-c-and-fortran-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Julia function. Arguments to [`cfunction()`](@ref) are as follows:

1. A Julia Function
2. Return type
3. A tuple of input types
3. A tuple type of input types

Only platform-default C calling convention is supported. `cfunction`-generated pointers cannot
be used in calls where WINAPI expects `stdcall` function on 32-bit windows, but can be used on WIN64
Expand Down Expand Up @@ -192,11 +192,11 @@ a C `int`, so we must be sure to return `Cint` via a call to `convert` and a `ty
In order to pass this function to C, we obtain its address using the function `cfunction`:

```jldoctest mycompare
julia> const mycompare_c = cfunction(mycompare, Cint, (Ref{Cdouble}, Ref{Cdouble}));
julia> const mycompare_c = cfunction(mycompare, Cint, Tuple{Ref{Cdouble}, Ref{Cdouble}});
```

[`cfunction()`](@ref) accepts three arguments: the Julia function (`mycompare`), the return type
(`Cint`), and a tuple of the argument types, in this case to sort an array of `Cdouble`
(`Cint`), and a tuple type of the input argument types, in this case to sort an array of `Cdouble`
([`Float64`](@ref)) elements.

The final call to `qsort` looks like this:
Expand Down