KwMap.net - browse the Keyword Map of ferite.org
Fake native modules are a means of adding API to a script running within an application with exactly the same method as a module. Rather than let ferite load the module, you simply register the module, tell ferite to pre-load it, and away you go. The example below assumes a module compiled into the application.
The ferite_module_add_preload is important so that the module gets compiled into the script at compile time and therefore allows for initialisation code that gets executed to access the application. Please note that the .lib extension is very important. This is so that ferite knows that it is a native module and can handle it correctly [and also find it]. You should refer to the last chapter on writing native modules by hand for the information on how to write the native module. For those of you feeling slightly more lazy, read on, there is a cunning use of builder.
The above code should be placed before the calls to ferite_script_compile or ferite_compile_string.
|ferite et al © 2000-2004, Chris Ross|