pub type CreateFn = unsafe extern "C" fn(config_json: *const u8, config_len: usize) -> *mut Box<dyn Plugin>;Expand description
Type signature for the plugin creation function exported by cdylib plugins.
The function receives a UTF-8 JSON configuration string (pointer + length)
and returns a double-boxed Plugin trait object. The outer Box yields a
thin pointer (C-ABI safe); the inner Box<dyn Plugin> is a fat pointer
stored on the heap.
§Arguments
config_json— pointer to a UTF-8 JSON string, or null for default configconfig_len— length of the config string in bytes (0 if null)
§Returns
A thin pointer to a heap-allocated Box<dyn Plugin>. The caller takes
ownership and must free it via DestroyFn or
drop(Box::from_raw(ptr)).
§Safety
- If
config_jsonis non-null, it must be valid for reads ofconfig_lenbytes - The returned pointer must not be null