Spark! Fuzzy Logic Editor Help


Variables | Sets | Rules | API | Integration | Tutorial


Integrating Spark! With Applications

Spark! was designed to easily integrate with C++ applications.  

A simple integration program is included in the installation.  This program has been compiled with:

  • Microsoft Visual C++ v6.0
  • Borland's Free C++ compiler v5.5
  • g++ (version unknown) this is the C++ version of gcc

Check the readme.txt file with each sample to see more details on the compiler used.

Enough!  Let's get to the good stuff...

Important Thing #1

The first important thing to know is what compiler you'll be using.  If you're using a compiler that can import classes from a dll created with Microsoft Visual C++ or not.  Unless you're using MSVC, you probably fall in the "not" column.

The ONLY difference is the class you use to integrate with Spark!.  If you're using MSVC++ you use SparkModel, otherwise you use SparkModelWrapper.

Here's the quick explanation on the differences.

SparkModel vs. SparkModelWrapper

These two classes have the SAME membership functions.  The only difference is that SparkModel is exported from SparkModel.dll.  SparkModelWrapper calls the 'C' functions exposed in the dll - it does not call them through the class.

Back to list of important things

Important Thing #2

The position of the variables in the Spark! UI do NOT correspond to the index of the variable that is passed to functions such as set_value() and get_value().  The index of the variable should be obtained from the .h file exported from Spark!.  Read more about exporting .h files.

Back to list of important things

Important Thing #3

Communication between Spark! and your application is via IPC (InterProcess Communication).  The IPC is set up when a model is loaded.  This means that if you are debugging an application and add or remove a variable in Spark! your application will not be able to communicate with the new variable (or will think the deleted variable still exists) until your application re-loads the Spark! model.

Along the same lines, IPC is not set up until a model is saved for the first time.

Note: Adding/Deleting rules or terms does NOT require the model to be reloaded.

Back to list of important things