NAME

idl2xs_c - IDL compiler to extension interface between Perl and C code

SYNOPSYS

idl2xs_c [options] spec.idl

OPTIONS

All options are forwarded to C preprocessor.

With the GNU C Compatible Compiler Processor, useful options are :

-D name
-D name=definition
-I directory
-I-
-nostdinc

DESCRIPTION

idl2xs_c is an alternative to h2xs and XS language when an IDL interface is available.

idl2xs_c parses the given input file (IDL) and generates :

  • a Perl stub spec.pm

    (deals with CDR serialization, and autoload)

  • a C stub spec.c

    (deals with Perl API)

  • a C stub cdr_spec.c

    (deals with CDR serialization)

  • a include file spec.h

    (following the language C mapping rules)

  • a C skeleton skel_spec.c0

  • Makefile.PL

  • Makefile

    (from Makefile.PL)

  • test.pl

  • MANIFEST

  • Changes

idl2xs_c is a Perl OO application what uses the visitor design pattern. The parser is generated by Parse::Yapp.

idl2xs_c needs a cpp executable.

idl2xs_c needs CORBA::IDL and CORBA::C modules.

CORBA Specifications, including (IDL : Interface Language Definition and CDR : Common Data Representation) and C Language Mapping are available on <http://www.omg.org/>.

CORBA mapping for Perl [mapping.pod - Draft 1, 7 October 1999] comes with the package CORBA::MICO or CORBA::ORBit.

Exceptions are implemented using the Error module.

TUTORIAL

EXAMPLE 1

The file Calc.idl describes the interface of a simple calculator.

First, run :

idl2xs_c Calc.idl

Second, make skel_Calc.c from skel_Calc.c0 by completing each methode between tag START_EDIT and STOP_EDIT :

// IDL : long Add(in long val1, in long val2);

CORBA_long
Calc_Add(
    Calc _o,
    CORBA_long val1, // in (fixed length)
    CORBA_long val2, // in (fixed length)
    CORBA_Environment * _ev
)
{
/* START_EDIT (Calc_Add) */
    return val1 + val2;
/* STOP_EDIT (Calc_Add) */
}

Third, build :

make
make test
make install

Fourth, if you use Test::Unit, you can continue with :

cd testunit
testrunner suite_calc

Finally, using the extension module :

use Calc;
my $calc = new Calc();
print $calc->Add(2, 3);

SEE ALSO

cpp, perl, idl2html, idl2c

COPYRIGHT

(c) 2002 Francois PERRAD, France. All rights reserved.

This program and all CORBA::XS modules are distributed under the terms of the Artistic Licence.

AUTHOR

Francois PERRAD <perrad@besancon.sema.slb.com>