# Rust FFI Example **Repository Path**: luke-project-practice/rust-ffi-example ## Basic Information - **Project Name**: Rust FFI Example - **Description**: Rust Foreign Function Interface Example - **Primary Language**: Rust - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-07-02 - **Last Updated**: 2025-03-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 现在项目根目录建立 build 目录,然后进入 build 目录,执行以下命令来构建 C 语言的动态库: ```shell cmake .. make ``` 构建完成后,在 lib 目录下会生成一个名为 libhello.so 的动态库文件,在 bin 目录下会生成一个名为 hello-test 的可执行文件。 然后运行 `cargo run` 命令,会在控制台输出 `Hello World from C!` 字样,证明 Rust 语言调用了 C 语言的动态库。