You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was not able to successfully build my project with such a declaration, I always ended up having "free function without a body" errors. After having compared this approach with severalothersources, it seems to me that the only correct way to declare this function would be
315: Correct C interop declarations r=adamgreig a=JVMerkle
Functions with external C linkage have to be wrapped with `extern
"C" { ... }`, `extern "C"` as part of the function signature is not
sufficient.
Resolves#236
Signed-off-by: Julian Merkle <[email protected]>
Co-authored-by: Julian Merkle <[email protected]>
In chapter 9.1 "A little C with your Rust", the
extern "C"
function is declared withI was not able to successfully build my project with such a declaration, I always ended up having "free function without a body" errors. After having compared this approach with several other sources, it seems to me that the only correct way to declare this function would be
The
pub extern "C" fn ...
syntax only seems to be valid to expose Rust's functions.Please correct me if I'm wrong.
Furthermore, the
#[link(name = "<library-name>")]
could be prepended, possibly with a reference to further documentation.The text was updated successfully, but these errors were encountered: