Re: mixed language coding
- From: Paolo Molaro <lupus ximian com>
- To: gtk-perl <gtk-perl-list gnome org>
- Subject: Re: mixed language coding
- Date: Wed, 20 Jun 2001 13:02:21 +0200
On 06/19/01 Jim Edwards wrote:
I tried this last week and didn´t get the response I had hoped for.
Please allow me to try again:
I have an application in Perl and another in c that I want to combine
into a single app. Currently the perl code uses perl/Tk and the c code
does not have a gui. My plan is to create a gtk+ gui using glade. As
I see it there are a few approachs to the multi language issue:
The perl code would have one or two dialog windows that would keep the
focus while open. The c code is much more complex.
1. Write all the gui in c and call the perl code from within callback
wrappers written in c.
This seems like it would involve a lot of interface writing.
Uhm, I don't know if this makes sense: if the non-ui part is already
written in C and you write also the GUI in C, where does perl fit?
2. Write the part of the gui for the perl in perl and the rest in c -
I think i would then need many fewer calls from c to perl
possibly only two - one to setup the interface and another to
invoke the dialog.
Does anyone know of an example that does this and what kind of problems
i might encounter?
It depends what kind of graphical interface you need or how complex is the
interface to the C code. Basically:
1) if the C interface is complex, just maintain the C program and
embed a perl interpreter that will be invoked to do the GUI stuff
(this is the way I did the perl bindings for AbiWord). perlembed
is the manpage you're looking for to do this.
2) the C interface is simple: wrap it in an XS module and use that module
in your GUI program written in perl (you will need the perlxs and perlguts
manpages for this item). This is a solution that allows for more
flexibility: it may be worth it even if the C interface is complex
(for example creating the XS module for the Gtk+ library surely was
worth it:-).
The first solution may be more simple if you don't know (or don't want
to know:-) how XS works.
lupus
--
-----------------------------------------------------------------
lupus debian org debian/rules
lupus ximian com Monkeys do it better
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]