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] Creating Native Modules[up][toc]Ferite-C File Contents [next]


Builder

Ferite-c files (.fec) are compiled using a special tool, called the builder which is run on the command line. The builder is only used for the creation of native modules. It is not required in order to run pre-built native modules. Depending on your ferite installation, you may need to install a development package to have access to the builder.

What does builder do?

The builder reads a ferite-c file, and creates the necessary C source, header files, and automake file that will be needed to compile the module. It takes several command line parameters, only a few of which we will cover here. You can pass builder either --help or -h on the command line to see all of the available options.

The switch we are currently most interested is -m. The -m switch allows you to specify the name of your module to the builder. This name will be used to determine the names of the files builder will create while reading the ferite-c file. If you do not specify a name using -m, it will default to modulename. For simplicity we will also use th -c and -f switches, which prevent the creation of a config.m4 and Makefile.am, respectively.

Example of using the builder:

    $ builder -c -f -m mymodule mymodule.fec
    			

When you run builder, it will create several output files, named according to the module name. The main files created are:

  • modulename_core.c (holds native module init and deinit functions)

  • modulename_misc.c (holds native code for the anonymous/_start function, if any)

  • modulename_header.h (holds include statements that the various c files need)

  • modulename_classname.c (you will get one of these for every class defined in the .fec)

  • modulename_namespacename.c (you will get one of these for every namespace in the .fec)

These files will need to be compiled into a shared object or a DLL (depending on your platform, for simplicity we will simply refer to shared objects from here on, but they are interchangeable with DLL's). Both the resulting shared object and the original ferite-c file are needed for ferite to successfully import the module. You will need to place the ferite-c file in the module path, which was explained in the previous chapter. The shared object will need to be placed in the native search path. This is where ferite looks for all native modules. It is usually /usr/lib/ferite/platform, though the actual location may vary depending on the installation. (ex. /usr/lib/ferite/linux-gnu-i686)

Note: If you are interested in auto generation tools for standalone modules, you will probably be interested in the generate-module utility. The builder creates input files for automake and the like specifically tailored for modules that will be included with the ferite source. The generate-module utility is geared more towards auto generation for standalone modules. We will not cover generate-module in this guide.



[previous] Creating Native Modules[up][toc]Ferite-C File Contents [next]
ferite et al © 2000-2004, Chris Ross