Maintainer
Alex Cozzi
Description
SWIGEIFFEL is an extension module for » SWIG. It generates Eiffel interfaces to C libraries.
Categories
Versions
Features
- All the function names are converted to Eiffel style: all lowercase and with underline as separator. For example: "GlDraw" will be converted in Eiffel as "gl_draw"
- C constant and enums are converted in a similar fashion, but the first letter is uppercase. In addition, to avoid conflict with function names (because C is case sensitive and Eiffel not) every constant name has a suffix "_const". For example, GL_AREA will be in Eiffel "Gl_area_const".
- All "_" at the beginning are stripped: "__aFunction" -> "a_function"
- The code generation takes care not to produce names that conflicts with predefined Eiffel identifiers inherited from "ANY".
- The list is defined as an array of string in EIFFEL::initialize.
- You can add your own if you have problems.
- In case of conflicts, a number will be added at the end of the new identifier, starting from 1 until a new unique identifier is generated. For example: "system" is predefined, so a new system will generate "system1". A warning is issued by the swigeiffel command when this happens.
- In order to generate the correct glue code it is necessary to use cecil. A dummy function, init, has to be called. This function simply creates a string and all the arrays of the basic types. This is necessary to force the SmallEiffel compiler to generate code for these classes, otherwise the functions "string_to_external", "real_array_to_external", etc are not defined and the Eiffel compilation will abort in the linking phase.
Bugs and limitations
- function pointers are still not supported by SWIG
- SWIG has problems with complicated "#define"s
- arrays of shorts are unsupported: the glue is generated, but the C function will get a pointer to an array of int. TAKE CARE!
- The typemaps are not tested at all!
Example
A working example is provided in the OpenGl directory of the distribution.
Supported compilers
Licensing
Packages using SWIGEIFFEL