Skip to content

Instantly share code, notes, and snippets.

@saivert
Created May 27, 2021 13:04
Show Gist options
  • Save saivert/6d457611c04bf024d27fcc62b46cdaa7 to your computer and use it in GitHub Desktop.
Save saivert/6d457611c04bf024d27fcc62b46cdaa7 to your computer and use it in GitHub Desktop.
#[no_mangle]
pub unsafe extern "C" fn libsampleplugin_load(functions: *const DB_functions_t ) -> *mut c_void {
// "functions" argument is a pointer to a struct with function pointers for each API function.
// Callable like so:
let confdir: &CStr = CStr::from_ptr( (*functions).get_config_dir.unwrap()() );
println!("From rust: Deadbeef config dir is {}", confdir.to_str().unwrap());
// How to store a reference or pointer to this structure in a global variable so I can reference it later?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment