Skip to content

Commit

Permalink
Merge pull request #14 from JamesHallowell/entry-points-v10
Browse files Browse the repository at this point in the history
Update the library entry point version to v10
  • Loading branch information
JamesHallowell committed Apr 27, 2024
2 parents 7c9ff17 + 430b194 commit 2cdb250
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ linux, macos ]
cmajor_version: [ 0.9.2170 ]
cmajor_version: [ 1.0.2462 ]
include:
- os: linux
runner: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ pub struct Library {
entry_points: *mut EntryPoints,
}

type CMajorGetEntryPointsV9 = unsafe extern "C" fn() -> *mut c_void;
type CMajorGetEntryPointsV10 = unsafe extern "C" fn() -> *mut c_void;

#[cfg(feature = "static")]
extern "C" {
fn cmajor_getEntryPointsV9() -> *mut c_void;
fn cmajor_getEntryPointsV10() -> *mut c_void;
}

impl Library {
#[cfg(feature = "static")]
pub fn new() -> Self {
let entry_points = unsafe { cmajor_getEntryPointsV9() }.cast();
let entry_points = unsafe { cmajor_getEntryPointsV10() }.cast();
Self { entry_points }
}

pub fn load(path_to_library: impl AsRef<Path>) -> Result<Self, libloading::Error> {
const LIBRARY_ENTRY_POINT: &[u8] = b"cmajor_getEntryPointsV9";
const LIBRARY_ENTRY_POINT: &[u8] = b"cmajor_getEntryPointsV10";

let library = unsafe { libloading::Library::new(path_to_library.as_ref()) }?;
let entry_point_fn: libloading::Symbol<CMajorGetEntryPointsV9> =
let entry_point_fn: libloading::Symbol<CMajorGetEntryPointsV10> =
unsafe { library.get(LIBRARY_ENTRY_POINT)? };

let entry_points = unsafe { entry_point_fn() }.cast();
Expand Down
1 change: 1 addition & 0 deletions src/ffi/performer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct PerformerVTable {
iterate_output_events:
unsafe extern "system" fn(*mut Performer, u32, *mut c_void, HandleOutputEventCallback),

reset: unsafe extern "system" fn(*mut Performer),
advance: unsafe extern "system" fn(*mut Performer),
get_string_for_handle:
unsafe extern "system" fn(*mut Performer, u32, *mut isize) -> *const c_char,
Expand Down

0 comments on commit 2cdb250

Please sign in to comment.