Re: Using C Libraries
- From: Raja Mukherji <rajamukherji@xxxxxxxxx>
- Date: Mon, 12 Oct 2009 01:21:33 -0700 (PDT)
On Oct 11, 3:07 pm, Chris Cross <sidney.reilley...@xxxxxxxxx> wrote:
First off, I'm NOT a C programmer.
According to:http://www.cs.arizona.edu/icon/docs/ipd240.htm
C functions can be called in one of 2 ways.
I would be interested in using the "dynamic loading" method. The above
document states:
"Functions loaded by Icon must provide a particular interface,
described below, and so they are usually written specifically for use
with Icon."
I take it that most C function libraries in current use - GTK, e.g. -
could NOT be linked to Icon, as they probably were NOT coded for use
with Icon. Am I correct? Is there (now) a work-around? TIA!
--
Chris
To use an external library, you would have to write C functions using
the interface described in http://www.cs.arizona.edu/icon/docs/ipd240.htm
to wrap the functions in the external libraries. You'd need one
wrapper function per external function, which could be automatically
generated from a description of the functions in the library. For
example, to create wrappers for Wrapl (my own programming language,
based on Icon), I use gapi2-parser from the mono project to extract
the function information from the GTK+ libraries. There's also the
newer gobject-introspection tools. For other libraries I use gcc-xml
or simply hand code the wrapper functions.
For GTK+, there does seem to be an easier way: http://www.gtk-server.org/.
I've never tried it, but it seems to use simple file input/output to
control a GTK+ daemon running as a separate process. It lists Icon as
a supported language and even has sample Icon code.
.
- Follow-Ups:
- Re: Using C Libraries
- From: Chris Cross
- Re: Using C Libraries
- References:
- Using C Libraries
- From: Chris Cross
- Using C Libraries
- Prev by Date: Re: Problem with Mitchell slides code
- Next by Date: Re: Icon syntax highlighting
- Previous by thread: Using C Libraries
- Next by thread: Re: Using C Libraries
- Index(es):
Relevant Pages
|