UserFunctions

A full discussion of the mechanics for creating and implementing UserFunctions with CLIPS is contained in the CLIPS documentation, (i.e. this is not meant to teach you how to create user functions, merely demonstrate how to do it specific to the CLIPS.DLL). This feature is implemented in the 32 bit versions (and RISC versions) only, look for a version number x.xx.28 or later, (i.e. 6.04.28).
 

Note!

You must have JavaScript enabled for these web pages to function properly.

Steps

Building user functions for the DLL...

  1. create a new project that includes: -DllMain.C -Usrfunc.C -clpusrfn.def -Clips.Lib (provided with the 32 bit DLL) [rather than include the Clips.Lib - you can dynamically hook DefineFunction and any other needed CLIPS funcs, your call...]
  2. Edit Usrfunc.c/.h to establish your userfunctions... Edit CLPUSRFN.DEF to export the userfunctions
  3. build the CLPUSRFN.DLL, and put it where CLIPS.DLL can find it

I have provided all the above to implement a simple userfunction called message-box, and provided a sample CLIPS batch file. Simply D/L the UserFunction sample provided on this site. To test same, you can use the CLIPS Test sample project, (for VC++ 4.x), also available on this site.