forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust: Link with rlib external dependencies
When linking with a Rust rlib, we should also link with its external system dependencies. This was currently done only for C ABI crates, do it for both rlib and staticlib now.
- Loading branch information
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern crate wrapper; | ||
|
||
fn main() { | ||
wrapper::func(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
project('system deps', 'rust') | ||
|
||
glib = dependency('glib-2.0', required: false) | ||
if not glib.found() | ||
error('MESON_SKIP_TEST: Need glib system dependency') | ||
endif | ||
|
||
rlib = static_library('wrapper', 'wrapper.rs', dependencies: glib) | ||
exe = executable('main', 'main.rs', link_with: rlib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extern "C" { | ||
fn g_hash_table_new() -> *mut std::ffi::c_void; | ||
} | ||
|
||
pub fn func() { | ||
unsafe { | ||
g_hash_table_new(); | ||
} | ||
} |