Skip to content

mate-desktop-legacy-archive/python-corba

Repository files navigation

PyMateCORBA
=======

This is a Python language binding for the MateCORBA2 CORBA implementation.
It aims to take advantage of new features found in MateCORBA2 to make
language bindings more efficient.  This includes:
  - Use of MateCORBA2 type libraries to generate stubs
  - use of the MateCORBA_small_invoke_stub() call for operation
    invocation, which allows for short circuited invocation on local
    objects.

Where it makes sense, this binding tries to stay compatible with the
Python language mapping, which can be found on the OMG web site:
    http://www.omg.org/cgi-bin/doc?formal/02-09-07

Currently only the client side of the binding has been done.


Required MateCORBA2 Version
-----------------------

Due to a number of bugs in MateCORBA2 2.4.3, PyMateCORBA requires version
2.4.4 or later.  Versions of MateCORBA2 taken from the HEAD branch can
also be used.

As some of the bugs were in the IDL compiler, you may need to
recompile code generated by the IDL compiler.  This includes the
"MateComponent" typelib (distributed with libmatecomponent), and probably other
libraries.


Typelibs
--------

Before using an interface, you should build a typelib for it.  The
basic steps are:

 $ matecorba-idl-2 --imodule filename.idl
 $ gcc -fPIC -c filename-imodule.c `pkg-config --cflags MateCORBA-2.0`
 $ gcc -shared -o filename_module.so filename-imodule.o \
        `pkg-config --libs MateCORBA-2.0`

You can then install the imodule in $(prefix)/lib/matecorba-2.0.

Alternatively, you can install it somewhere else and set the
MATECORBA_TYPELIB_PATH environment variable to point at it.

You can then load the typelib with the following python statement:

 >>> MateCORBA.load_typelib('filename')

This will generate stubs and skeletons for all the types in the IDL
file.


Loading IDL Files
-----------------

Since version 2.6, MateCORBA2 has had support for generating typelib
information from IDL files at runtime.  PyMateCORBA can make use of this
functionality:

 >>> MateCORBA.load_file('filename.idl' [, 'cpp arguments'])

As with load_typelib(), this will generate stubs and skeletons.


Automatic Type Discovery
------------------------

If you are only interested in acting as a client (ie. calling
operations on objects), then it may not be necessary to build a
typelib.  MateCORBA2 includes introspection support that allows PyMateCORBA to
snarf typelib information from an object reference, provided that the
server is implemented with MateCORBA2.

This makes client side operation almost painless.