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 | New
and select MFC AppWizard(dll) - Fill in the
Project name
asclpusrfn
- Click
Finish
and then clickOK
- Click
Project | Settings
to open theProject settings
dialog box. You could have also pressedAlt-F7
- Click the
C/C++
tab and under the heading ofCategory
selectCode Generation
- Under
Use run-time library
selectMultithreaded DLL
- Click the
Link
tab and under the heading ofObject/library modules
fill in the location of the fileClips.lib
. This file is provided with the download ofCLIPS.DLL
- Click
OK
to close theProject settings
dialog box - One file AppWizard will generate for you is
clpusrfn.cpp
. Place your version ofUserFunctions
here after the statementCClpusrfnApp theApp;
- You will also need to #include
clips.h
inclpusrfn.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
UserFunctions
itself. 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