Skip to content

Commit

Permalink
Fix inventory crate for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Lupus committed Nov 5, 2024
1 parent 7706451 commit db64581
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 32 deletions.
34 changes: 25 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ waker-fn = "1.2"
futures-lite = "2.3"
ocaml-gen = "0.1.5"
highway = "1.2.0"
linkme = "0.3.29"
tokio = { version="1.40.0", features=["rt","rt-multi-thread"] }
ocaml-rs-smartptr = { version = "0.1.0" }
ocaml-lwt-interop-macro = { path="macro", version = "0.1.0" }
Expand All @@ -31,4 +32,4 @@ members = [
]

[patch.crates-io]
ocaml-rs-smartptr = { git = "https://github.com/Lupus/ocaml-rs-smartptr.git" }
ocaml-rs-smartptr = { git = "https://github.com/Lupus/ocaml-rs-smartptr.git", branch="linkme" }
33 changes: 18 additions & 15 deletions src/stubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ pub fn lwti_executor_run_pending(executor: Executor) {
////////// Register Types & Traits //////////
///////////////////////////////////////////////////////////////////////////////

register_rtti! {
#[linkme::distributed_slice(ocaml_rs_smartptr::registry::REGISTRY_PLUGINS)]
static REGISTRY_PLUGIN: ocaml_rs_smartptr::registry::Plugin = register_rtti!({
register_type!(
{
ty: crate::domain_executor::DomainExecutor,
Expand All @@ -72,23 +73,25 @@ register_rtti! {
object_safe_traits: [],
}
);
}
});

///////////////////////////////////////////////////////////////////////////////
////////// OCaml bindings generation //////////
///////////////////////////////////////////////////////////////////////////////

ocaml_gen_bindings! {
decl_module!("Future", {
decl_type!(Future => "t");
decl_func!(lwti_mlbox_future_create => "create");
decl_func!(lwti_mlbox_future_resolve => "resolve");
decl_func!(lwti_mlbox_future_reject => "reject");
});

decl_module!("Executor", {
decl_type!(Executor => "t");
decl_func!(lwti_executor_create => "create");
decl_func!(lwti_executor_run_pending => "run_pending");
#[linkme::distributed_slice(ocaml_rs_smartptr::ocaml_gen_extras::OCAML_GEN_PLUGINS)]
static OCAML_GEN_PLUGIN: ocaml_rs_smartptr::ocaml_gen_extras::OcamlGenPlugin =
ocaml_gen_bindings!({
decl_module!("Future", {
decl_type!(Future => "t");
decl_func!(lwti_mlbox_future_create => "create");
decl_func!(lwti_mlbox_future_resolve => "resolve");
decl_func!(lwti_mlbox_future_reject => "reject");
});

decl_module!("Executor", {
decl_type!(Executor => "t");
decl_func!(lwti_executor_create => "create");
decl_func!(lwti_executor_run_pending => "run_pending");
});
});
}
1 change: 1 addition & 0 deletions test-stubs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async-task = "4.7.1"
ocaml = "1.0.1"
futures-lite = "2.3"
paste = "1.0.15"
linkme = "0.3.29"
tokio = { version="*", features=["time"] }
ocaml-rs-smartptr = { version = "0.1.0" }
ocaml-lwt-interop = { path=".." }
Expand Down
16 changes: 9 additions & 7 deletions test-stubs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ pub fn lwti_tests_test_sync_call(f: OCamlFunc<(), ()>) {
////////// OCaml bindings generation //////////
///////////////////////////////////////////////////////////////////////////////

ocaml_gen_bindings! {
decl_module!("Tests", {
decl_func!(lwti_tests_bench => "bench");
decl_func!(lwti_tests_test1 => "test_1");
decl_func!(lwti_tests_test2 => "test_2");
decl_func!(lwti_tests_test_sync_call => "test_sync_call");
#[linkme::distributed_slice(ocaml_rs_smartptr::ocaml_gen_extras::OCAML_GEN_PLUGINS)]
static OCAML_GEN_PLUGIN: ocaml_rs_smartptr::ocaml_gen_extras::OcamlGenPlugin =
ocaml_gen_bindings!({
decl_module!("Tests", {
decl_func!(lwti_tests_bench => "bench");
decl_func!(lwti_tests_test1 => "test_1");
decl_func!(lwti_tests_test2 => "test_2");
decl_func!(lwti_tests_test_sync_call => "test_sync_call");
});
});
}

0 comments on commit db64581

Please sign in to comment.