ExpandCollapsePrev Next Index

+ 9.1 Resource Management

The simple header and body statements and requires clause of the previous section hint at the existence of a unique and very powerful dependency management system which is part of Felix. This system includes the mentioned code generation control, but it also extends to a much more sophisticated package management system that is also responsible for linking any libraries that your program needs.

Gone are the days when you must specify include files in your code, header file paths in your compiler command line, or library paths, and libraries when linking. Felix does all of that automatically.

The key to this system is a database maintained in the config directory of your Felix installation. A quick list of some of the files shows something like this:

~/felix>ls build/release/config
__init__.py             flx_executil.fpc        glu.fpc                 sdl.fpc
__init__.pyc            flx_gc.fpc              glut.fpc                sqlite3.fpc
build                   flx_glob.fpc            gmpxx.fpc               target
demux.fpc               flx_i18n.fpc            gsl.fpc                 tre.fpc
faio.fpc                flx_ioutil.fpc          host                    unistd.fpc
flx.fpc                 flx_pthread.fpc         judy.fpc                unix
flx_arun.fpc            flx_run.fpc             macosx                  win32
flx_async.fpc           flx_strutil.fpc         mmap.fpc
flx_dynlink.fpc         gl.fpc                  plat_linux.fpc
flx_exceptions.fpc      glext.fpc               re2.fpc

All those *.fpc files are entries in the configuration database which specify a package. fpc stands for Felix Package Config. The associated processor is written in Felix and is called flx_pkgconfig. Here's one of them:

~/felix>less build/release/config/flx_gc.fpc
Name: flx_gc
Platform: Unix 
Description: Felix default garbage collector (Unix)
provides_dlib: -lflx_gc_dynamic
provides_slib: -lflx_gc_static
includes: '"flx_gc.hpp"'
Requires: judy

This file provides some descriptive information, it tells what the associated header file is, and it tells how to link the shared or static library associated with the package. It also specifies that this package depends on another, namely judy.

Here's an fpc file for the C++ binding of GNU's Multiple Precision Arithmetic library:

requires_slibs: -L/usr/local/lib -lgmp
requires_dlibs: -L/usr/local/lib -lgmp
provides_dlib: -L/usr/local/lib -lgmpxx
provides_slib: -L/usr/local/lib -lgmpxx
cflags: -I/usr/local/include

These database files contain platform dependent information. It is put there so you do not need to do so in your program! Instead you just write:

  requires package "flx_gc", package "gmpxx";

wherever a requires clause is allowed, and Felix will find the header files and libraries you need automatically.