Link against Framework (MacOS)


Hello, currently I try to link against a .framework file in rust-lang however I needed to create a for that like that:

if cfg!(target_os = "macos") {
    let out_dir = "/Library/Frameworks";
    println!("cargo:rustc-link-search=framework={}", out_dir);

Now it starts compiling. However when running it will always spill out:

dyld: Library not loaded: @rpath/Nuance-OmniPage-CSDK-RunTime.framework/Versions/19.2-     15521.100/Libraries/libkernelapi.dylib
  Referenced from: /Users/schmitch/projects/envisia/finder/service/./target/debug/service
  Reason: image not found
Trace/BPT trap: 5

How could I fix that?



While I do not know if this is exactly the correct way you can do it like inside a Rust file

#[cfg(target_os = "macos")]
#[link(name = "Cocoa", kind = "framework")]
fn some_mac_function() {

This would link against the Cocoa framework on Mac.