Skip to content

Commit

Permalink
rust: add shared library testcase for "objects"
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
bonzini committed Feb 13, 2025
1 parent 1258e49 commit f61ae6e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test cases/rust/27 objects/lib1-dylib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extern "C" {
fn from_lib1();
}

#[no_mangle]
extern "C" fn from_lib2()
{
println!("hello world");
}

#[no_mangle]
pub extern "C" fn c_func()
{
unsafe { from_lib1(); }
}
4 changes: 4 additions & 0 deletions test cases/rust/27 objects/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ executable('lib1objs_as_dep', 'main.rs',
executable('lib2objs_as_dep', 'main.rs',
dependencies: declare_dependency(objects: lib2.extract_all_objects(recursive: false)),
link_with: lib1)

lib12 = shared_library('lib12', 'lib1-dylib.rs', objects: lib2.extract_all_objects(recursive: false),
rust_abi: 'c')
executable('lib12', 'main.rs', link_with: lib12)

0 comments on commit f61ae6e

Please sign in to comment.