Python bindings for ORBit

* Dynamic IDL
* Servants

* CVS ChangeLog


Project Links
* SourceForge
* Downloads
* Bugzilla
* Mailing List


* ORBit2
* ORBit2 Resources
* Perl bindings
* C++ bindings
Documentation: Dynamic IDL Compiling

Dynamic IDL Compiling

Python is a dynamic language, so why not take advantage of it? O-P doesn't use stubs or skeletons like most other ORBs, but instead compiles IDL files at run-time. This means incremental design and rapid prototyping can be done easily and quickly.

The function CORBA._load_idl() is used to load a specific IDL file. Other ORBs don't implement this function, of course, so in order for code to be portable from these ORBs, an alternative approach must be used. This approach is called "IDL preprocessing." When the CORBA module is imported for the first time, it scans a list of directories, naively (and quickly) parsing each IDL file to discover what modules and interfaces the IDL files provide. This list of directories is specified in the IDLPATH environment variable. If IDLPATH is unset, O-P defaults to the current directory, and the system IDL directories if they exist (/usr/share/idl and /usr/local/share/idl).

O-P hooks the import function to determine if the requested module exists in an IDL file. If it does, the IDL file is automatically parsed (using libIDL), processed into corresponding Python objects, and imported into the caller's namespace. Note that because ORBit-Python's CORBA module overloads the import function, you must import CORBA before importing any IDL modules.

When an IDL module is being imported, O-P attempts to make intelligent decisions about which files to actually parse using libIDL. For example, if you import Bonobo, O-P really only needs to process Bonobo.idl, and not the dozen or so other Bonobo_* files. In most cases, O-P's algorithms to narrow the list of IDL files for a module are sufficient, but sometimes they'll fail. If this happens to you, please report it as a bug. As a work-around, you can use CORBA._load_idl() to load the correct file(s), and then import the module.