Menu

Call waffles libraries (gclasses) from C?

Help
Anonymous
2013-05-13
2013-05-15
  • Anonymous

    Anonymous - 2013-05-13

    Hi List,
    gclasses are written in class based C++ code.

    Is there an interface to call the functionality as C functions?
    Thanks for any hints.

     
  • Mike Gashler

    Mike Gashler - 2013-05-13

    No, no one has ever requested this before. I suppose this would involve adding wrapper functions to the library, sort-of like this:

    extern "C" {
    void myWrapper() {
    GSomeClass c;
    c.dosomething();
    }
    }

    If you only need a few functions, this should be a simple modification. If you want to access the whole library this way, it would be a lot of work to write so many wrappers.

     
  • Anonymous

    Anonymous - 2013-05-14

    Thanks for the answer, I would like to access (all of?) Waffles from a Lisp that is very good at communicating with native C functionality (as found in .so and .h files), but I'm a bit confused about the options to talk to a library like Waffles (or gclasses) that is written as a C++ class hierarchy.

    I guess there is no way to access the gclasses methods directly from C. But writing countless wrappers seems much too tedious.

    What would be the alternatives for an Interfave between a Lisp and gclasses?

    1. write gclasses method-calls to a infile and pipe that as input to gclasses, and gclasses writes the results to an outfile that is then piped as input to the Lisp?

    2. use the waffles CLI?

    3. call waffles with command-line options from the lisp and let it write its output to a file that is then read by the lisp program?

     
  • Mike Gashler

    Mike Gashler - 2013-05-14

    Here is another option (disclaimer: I have never tried it): http://www.swig.org/

     
  • Anonymous

    Anonymous - 2013-05-15

    Very nice tip indeed, thank you! Probably exactly what I was looking for, lets see if I'm prepared to handle it.

     

Anonymous
Anonymous

Add attachments
Cancel