In the Advanced Programming Guide, there's no mention that I can find for how to actually create a DATA_OBJECT to pass to SetDefglobalValue. DATA_OBJECTs seem to be managed by the garbage collector, so I don't want to just malloc one and stuff it in without knowing that's expected.
I'm working on a SWIG target for CLIPS, and I want to expose constants as globals. I've got the other basics working in SWIG so far.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the Advanced Programming Guide, there's no mention that I can find for how to actually create a DATA_OBJECT to pass to SetDefglobalValue. DATA_OBJECTs seem to be managed by the garbage collector, so I don't want to just malloc one and stuff it in without knowing that's expected.
I'm working on a SWIG target for CLIPS, and I want to expose constants as globals. I've got the other basics working in SWIG so far.
Thanks!
Just statically allocate a DATA_OBJECT in your function
DATA_OBJECT theDO;
/* Your code here to assign type and value to theDO */
SetDefglobalValue("yourGlobal",&theDO);
Ah, so it's copy semantics. Thanks!