Re: C++/TCL Need Solution to Compile Error c2784



JesusChuyCampos@xxxxxxxxx wrote:
It always sucks when the
simple "hello world" program works, but the real thing breaks. I' will
be looking into SWIG, because just like CPPTCL, if the SDK changes
rebuilding the DLL will be a breeze. But if worse comes to worse, I
guess I will have to learn the TCL C API like you mention and get it
done.

SWIG does its job very well. For a first approximation, you can probably just pass the headerfile into it like

swig -tcl8 -c++ headerfile.h


If you want a crisp tclish interface, you can improve the interface by writing proxy classes. Also exotic types can be integrated quite easy by providing a so called "typemap". With the typemap you can change the way SWIG interfaces TCL and C for specific function arguments. So you have the full control, but don't need to repeat tedious work. The only disadvantage may be some performance lost in comparison with a fully handwritten glue code.

Christian
.



Relevant Pages

  • Re: python libs v lisp coolness?
    ... although swig is quite good, ... in parsing the header files. ... Should be possible for cl-xml to parse and generate interface definitions ... >> generating wrapper functions for methods and stuff, ...
    (comp.lang.lisp)
  • SWIG for Python - returning 64 bit value
    ... I'm very new to SWIG and I'm trying to use SWIG to interface my Python ... Now I confirmed a Python Long value is correctly sent to a C routine. ...
    (comp.lang.python)
  • Redirect output
    ... I have a program which is written in C and interfaced with python via ... the function I call prints stuff out to the console. ... other than modifying the C code and re-generating the interface via ... Swig, any ideas? ...
    (comp.lang.python)
  • Re: Binary data INTO C extension?
    ... The SWIG typemap is actually quite simple. ... int sample_function(char* bytearray, int); ...
    (comp.lang.tcl)
  • Re: swig question
    ... I am using swig to provide a Tcl interface to a C library. ... returns a dynamically allocated string ... You need to write a typemap for this case. ...
    (comp.lang.tcl)