Skip to content

Commit

Permalink
Manual - note on calling conventions on Win64 (#19977)
Browse files Browse the repository at this point in the history
* Manual - note on calling conventions on Win64

Clarification based on discussion in mailing list https://discourse.julialang.org/t/callback-to-winapi/1381

* removed  whitespace

* manual changed cfunction

* whitespace removed
  • Loading branch information
Petr-Hlavenka authored and ihnorton committed Jul 11, 2017
1 parent f728d4e commit 9415c09
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/src/manual/calling-c-and-fortran-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ typedef returntype (*functiontype)(argumenttype,...)
```
The function [`cfunction()`](@ref) generates the C-compatible function pointer for a call to a
Julia library function. Arguments to [`cfunction()`](@ref) are as follows:
Julia function. Arguments to [`cfunction()`](@ref) are as follows:
1. A Julia Function
2. Return type
3. A tuple 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
(where `stdcall` is unified with C calling convention).
A classic example is the standard C library `qsort` function, declared as:
```c
Expand Down Expand Up @@ -872,7 +876,7 @@ ccall(@dlsym("myfunc", mylibvar), Void, ())

The second argument to [`ccall`](@ref) can optionally be a calling convention specifier (immediately
preceding return type). Without any specifier, the platform-default C calling convention is used.
Other supported conventions are: `stdcall`, `cdecl`, `fastcall`, and `thiscall`. For example (from
Other supported conventions are: `stdcall`, `cdecl`, `fastcall`, and `thiscall` (no-op on 64-bit Windows). For example (from
`base/libc.jl`) we see the same `gethostname`[`ccall`](@ref) as above, but with the correct
signature for Windows:

Expand Down

0 comments on commit 9415c09

Please sign in to comment.