[−][src]Attribute Macro neon::main
#[main]
Marks a method as the main entrypoint for initialization in a Neon module. This attribute should only be used once in a module and will be called each time the module is initialized in a context.
#[neon::main] fn my_module(mut cx: ModuleContext) -> NeonResult<()> { let version = cx.string("1.0.0"); cx.export_value("version", version)?; Ok(()) }
If multiple functions are marked with #[neon::main]
, there may be a compile error:
error: symbol `napi_register_module_v1` is already defined