How to invoke a C function from Tcl

While this topic might be regarded as merely a special case of the more general topic of "Extending Tcl", many newcomers to the subject conceive it in these more mechanical terms.

[...]

Variations:

  • Critcl and so on
  • compiled-in extensions
  • "impedance-matching" loaders
  • Incr TCL has Itcl_RegisterC function to register C functions as @function symbols in Itcl class members

Among the latter, Windows variants include

and, in a different way,

[Mention SWIG.]


For those broad-minded enough to replace "function" by process, TV recommends IPC:

TV Don't forget that a possibly completely platform independent method is to pass messages over a socket to a C-code based process. Example: [L1 ]. Long ago I've made some automation scripts to generate the frame for this sort of method which is quite possible in tcl.