rust: add shared library testcase for "objects"

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pull/14031/head
Paolo Bonzini 3 months ago
parent 4644779ebf
commit 542dc2c937
  1. 15
      test cases/rust/27 objects/lib1-dylib.rs
  2. 10
      test cases/rust/27 objects/meson.build

@ -0,0 +1,15 @@
extern "C" {
fn from_lib1();
}
#[no_mangle]
extern "C" fn from_lib2()
{
println!("hello world from rust");
}
#[no_mangle]
pub extern "C" fn c_func()
{
unsafe { from_lib1(); }
}

@ -16,3 +16,13 @@ executable('lib1objs_as_dep', 'main.rs',
executable('lib2objs_as_dep', 'main.rs',
dependencies: dep2,
link_with: lib1)
lib12 = shared_library('dylib2objs', 'lib1-dylib.rs',
objects: lib2.extract_all_objects(recursive: false),
rust_abi: 'c')
executable('dylib', 'main.rs', link_with: lib12)
lib12 = shared_library('dylib2objs_as_dep', 'lib1-dylib.rs',
dependencies: dep2,
rust_abi: 'c')
executable('dylib_as_dep', 'main.rs', link_with: lib12)

Loading…
Cancel
Save