Introduced dylib extension format, cleared up shutdown sequence
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::ext_port::ExtPort;
|
||||
|
||||
pub type ExtCx = api::binary::ExtensionContext;
|
||||
|
||||
struct Spawner(api::binary::Spawner);
|
||||
struct Spawner(api::binary::SpawnerBin);
|
||||
impl Drop for Spawner {
|
||||
fn drop(&mut self) { (self.0.drop)(self.0.data) }
|
||||
}
|
||||
@@ -28,3 +28,22 @@ pub fn orchid_extension_main_body(cx: ExtCx, builder: ExtensionBuilder) {
|
||||
spawn: Rc::new(move |fut| spawner.spawn(fut)),
|
||||
});
|
||||
}
|
||||
|
||||
/// Generate entrypoint for the dylib extension loader
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
/// ```
|
||||
/// dylib_main! {
|
||||
/// ExtensionBuilder::new("orchid-std::main")
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! dylib_main {
|
||||
($builder:expr) => {
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn orchid_extension_main(cx: ::orchid_api::binary::ExtensionContext) {
|
||||
$crate::binary::orchid_extension_main_body(cx, $builder);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user