Re: Using C Libraries



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.
.



Relevant Pages

  • Re: Using C Libraries
    ... could NOT be linked to Icon, as they probably were NOT coded for use ... wrapper function per external function, ... the function information from the GTK+ libraries. ... For GTK+, there does seem to be an easier way:http://www.gtk-server.org/. ...
    (comp.lang.icon)
  • Re: Using C Libraries
    ... could NOT be linked to Icon, as they probably were NOT coded for use ... wrapper function per external function, ... example, to create wrappers for Wrapl (my own programming language, ... the function information from the GTK+ libraries. ...
    (comp.lang.icon)
  • Re: Using C Libraries
    ... could NOT be linked to Icon, as they probably were NOT coded for use ... wrapper function per external function, ... example, to create wrappers for Wrapl (my own programming language, ... the function information from the GTK+ libraries. ...
    (comp.lang.icon)
  • Re: Using C Libraries
    ... could NOT be linked to Icon, as they probably were NOT coded for use ... wrapper function per external function, ... example, to create wrappers for Wrapl (my own programming language, ... the function information from the GTK+ libraries. ...
    (comp.lang.icon)
  • Re: Using C Libraries
    ... could NOT be linked to Icon, as they probably were NOT coded for use ... to wrap the functions in the external libraries. ... wrapper function per external function, ... the function information from the GTK+ libraries. ...
    (comp.lang.icon)