Skip to content

Update/rewrite "Calling Rust code from C" section #138

@ghost

Description

This https://doc.rust-lang.org/nomicon/ffi.html#calling-rust-code-from-c
( and even in the book here: https://doc.rust-lang.org/stable/book/ch19-01-unsafe-rust.html#calling-rust-functions-from-other-languages )

has no mention of all the other info needed to accomplish this, such as: compile as a cdylib by adding crate-type = [ "cdylib" ] in Cargo.toml [lib] section, or using cbindgen to generate a header file, or the gcc command line to compile the .cpp file.

(NOTE: the below link is now invalid as the author deleted their account.)
I've attempted all the needed stuff in a working example here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions