Menu

How to define defglobals within C-code

Help
2009-05-26
2012-11-23
  • Rob Moolhuijsen

    Rob Moolhuijsen - 2009-05-26

    Hi,

    I'm using CLIPS within a C program. I would like to define some defglobals directly from C via a buffer.

    Something like this:
    void *theEnv;
    char buffer[1000];

    theEnv    = GetCurrentEnvironment();
    sprintf(buffer, "(defglobal ?*var1* = 123 ?*var2* = 456)");
    ParseDefglobal(theEnv, buffer);

    Is this possible?

    Regards,

    Rob

     
    • Gary Riley

      Gary Riley - 2009-07-16

      Use the Build function, Section 4.1.7 of the Advanced Programming Guide. In your function, you'd use either

      Build(buffer);

      or

      EnvBuild(theEnv,buffer);

       

Log in to post a comment.