current stable:
0.99.6
unstable:
cvs (0.99.7)
General
  Home / News
  About
  Contact
  The Team

Obtaining
  Download
  Source Tarball
  CVS Web View
  Misc. Files

Documentation
  Introduction
The Manual
  Download [html]
  Download [pdf]
  View Online
API
  Download [html]
  View Online
Resources
  Script Examples

Developer
  Introduction
Developer Guide
  Download [html]
  Download [pdf]
  View Online
Ferite C API
  Download [html]
  View Online




Open Source Approved

SourceForge Logo
KwMap.net - browse the Keyword Map of ferite.org

[previous] Embedding Ferite[up][toc]Cheating With Builder [next]


Fake Native Modules

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.

    ferite_module_register_fake_module( "theapp.lib", theapp_register, theapp_unregister, theapp_init, theapp_deinit );
    ferite_module_add_preload( "theapp.lib" );
                            

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.



[previous] Embedding Ferite[up][toc]Cheating With Builder [next]
ferite et al © 2000-2004, Chris Ross