Loadfuncpp

A Dynamic Library used to aid Adding
External Functions written in C++ to
The Icon Programming Language

Carl Sturtivant, February 2010, version 0.91alpha

Features

  • Works with the existing Icon runtime system with no modification
  • Call Icon with call syntax from C++ and vice-versa, recursively
  • Has a simple way to create new Icon datatypes by inheritance
  • Write new Icon functions in C++ that suspend a sequence of results
  • Iterate in C++ through result sequences generated by Icon
  • All Icon functions, keywords and operators made available in C++
  • Takes care of garbage collection safety automatically

documentation
experimental binaries
compilation options

News

2010/2/10 (I am releasing this now having moved on to a new implementation of the language entirely.) There are no known bugs, but bugs almost certainly exist. This pack needs systematic in-depth testing for subtle issues connected to garbage collection. Specifically, the mechanism to call Icon from C++ pushes onto the top of the Icon stack a region used by a copy of the interpreter loop that's used to execute the Icon procedure called from C++. I have not investigated how the Icon stack is garbage collected, and this region does not extend the stack the way that Icon does. If this proves unsafe for garbage collection, the stack region for such a call may have to have suitable frames containing pointers to the lower part of the stack (or vice-versa) placed in it to repair this deficiency. Also, the way garbage collection safety of Icon values in C++ variables is ensured is to use the constructor to implicitly link them onto the far end of the main co-expression's safe list, and unlink them from there using the destructor. This is almost certainly safe from the usual call and return mechanism in iconx for protecting local variables, but needs testing and verification.

2009/1/20 fixed a bug where a call of any C++ external function that in turn calls Icon and afterIcon returns calls Icon::runerr would not correctly report the name and arguments of said function in the resulting traceback. Upped the version number to 0.91alpha.

2009/1/20 loadfuncpp now searches for a shared object on the path defined by the environment variable FPATH with the icon/bin directory appended if you specify no path. FPATH undefined leads loadfuncpp to search the current directory followed by the icon/bin directory.

2009/1/12 loadfuncpp has been completely overhauled, and the old version is now obsolete. Many small functions have been added to eliminate ambiguities in programs that use loadfuncpp, and the central class has been renamed and a class eliminated. Small pieces of missing functionality have been added. The documentation has been modified accordingly. It is now close to it's final form, and in need of some serious beta testing, and I have someone who has agreed to do that. Once this is done, loadfuncpp will be made available as a pack with the Icon 9.5 source distribution.