Fix C function FFI example in the Rust cheatsheet
This commit is contained in:
parent
8786405047
commit
e9bb571aff
1 changed files with 1 additions and 1 deletions
|
@ -211,7 +211,7 @@ Description C signature Equivalent
|
||||||
---------------------- ---------------------------------------------- ------------------------------------------
|
---------------------- ---------------------------------------------- ------------------------------------------
|
||||||
no parameters `void foo(void);` `fn foo();`
|
no parameters `void foo(void);` `fn foo();`
|
||||||
return value `int foo(void);` `fn foo() -> c_int;`
|
return value `int foo(void);` `fn foo() -> c_int;`
|
||||||
function parameters `void foo(int x, int y);` `fn foo(x: int, y: int);`
|
function parameters `void foo(int x, int y);` `fn foo(x: c_int, y: c_int);`
|
||||||
in-out pointers `void foo(const int* in_ptr, int* out_ptr);` `fn foo(in_ptr: *c_int, out_ptr: *mut c_int);`
|
in-out pointers `void foo(const int* in_ptr, int* out_ptr);` `fn foo(in_ptr: *c_int, out_ptr: *mut c_int);`
|
||||||
|
|
||||||
Note: The Rust signatures should be wrapped in an `extern "ABI" { ... }` block.
|
Note: The Rust signatures should be wrapped in an `extern "ABI" { ... }` block.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue