CLIPS User-Defined Functions with the CLIPS DLL
This document is meant as a supplement to User functions page found at the CLIPS DLL site.
To build CLPUSRFN.DLL using AppWizard under VC++ 5.0, follow these steps :
- Click
File | Newand select MFC AppWizard(dll) - Fill in the
Project nameasclpusrfn - Click
Finishand then clickOK - Click
Project | Settingsto open theProject settingsdialog box. You could have also pressedAlt-F7 - Click the
C/C++tab and under the heading ofCategoryselectCode Generation - Under
Use run-time libraryselectMultithreaded DLL - Click the
Linktab and under the heading ofObject/library modulesfill in the location of the fileClips.lib. This file is provided with the download ofCLIPS.DLL - Click
OKto close theProject settingsdialog box - One file AppWizard will generate for you is
clpusrfn.cpp. Place your version ofUserFunctionshere after the statementCClpusrfnApp theApp; - You will also need to #include
clips.hinclpusrfn.cpp. However, in order to avoid C++ name mangling you must enclose the #include in anextern "C"statement. For example,extern "C" { #include "c:\Clips\clipssrc\clips.h" } - You MUST use the extern "C" directive on all ALL exported functions and as well as
UserFunctionsitself. This applies in the header file and in the actual code for the function (i.e. the .h and .cpp files)
Last modified : 31-Jul-2003
Michael Giordano