macro_rules! entry_point_v2 {
($fn_name:ident, $register:expr) => { ... };
($fn_name:ident, options = $options:expr, $register:expr) => { ... };
($fn_name:ident, $policy:expr, $register:expr) => { ... };
}Expand description
Generates the #[unsafe(no_mangle)] unsafe extern "C" entry point using the
version-agnostic Connection facade.
This is the recommended alternative to entry_point!. The registration
callback receives a &Connection instead of a raw duckdb_connection,
giving access to the Registrar trait and to
both the connection and database handles.
§Arguments
$fn_name: The exact symbol nameDuckDBwill call.$register: A closure of typefn(&Connection) -> Result<(), ExtensionError>.
Like entry_point!, it takes an optional AbiPolicy, or
options = an EntryPointOptions, between the two, and fails to
compile under panic = "abort".
The closure runs in one transaction, so a failed LOAD leaves no catalog
entry behind; casts, replacement scans and configuration options are not
rolled back. See the
module documentation.
§Example
use quack_rs::connection::Registrar;
use quack_rs::error::ExtensionError;
use quack_rs::connection::Connection;
quack_rs::entry_point_v2!(my_extension_init_c_api, |con| {
// unsafe { con.register_scalar(builder)? };
Ok(())
});