I am not sure if this is the correct place to ask this, so please point
me to correct direction if it is not.

As far as I know, there is no "native" way of calling C/C++ libraries
from within Perl 5.  When C/C++ API involves structures, the
corresponding Perl binding uses hashes, and an intermediate step
converts the hash to a structure, and call the C program with the
converted structure.  An example of an elegent system which does this is
in gtk2-perl (http://gtk2-perl.sourceforge.net).  Muppet, please correct
me if I am wrong here.

Interfacing C/C++ libs this way involves creation of intermediate
structures that duplicates lots of data.  (Reminds me the the page cache
and buffer cache of the old Linux kernels.)  Obviously, Perl can't
convert a hash to a structure, because the structure of the structure is
not known, although it is a structure ;-)

But if the structure of the structure _is_ known, then there is the
possibility of kind of "rearranging" the hashes and calling the C/C++
library without duplicating the related data to a seperate structure.

I like to get involved in the parrot/perl6 development, and was just
wondering if this is something to work on.

        Anuradha

-- 

http://www.linux.lk/~anuradha/


Reply via email to