This simple testcase does not work:
CIMCValue value;
op = ce->ft->newObjectPath(ce, "root/cimv2", NULL , &status);
value.chars = "hello";
op->ft->addKey(op, "keyname", &value, CIMC_chars);
data = op->ft->getKey(op, "keyname", &status);
if (!status.rc)
printf("error retrieving key\n");
printf("data type: %i\n", data.type);
printf("data: %s\n", data.value.string);
// or also printf("data: %s\n", data.value.string->ft->getCharPtr(data.value.string, NULL));
The returned data is of type 5632 (CIMC_string) as expected, but the value is garbage
The same testcase, creating a CIMCString with ce->ft->newString, adding the key, and retrieving it, works.
If you change this line:
op->ft->addKey(op, "keyname", &value, CIMC_chars);
to:
op->ft->addKey(op, "keyname", "hello" CIMC_chars);
you should see the behavior you expect.
Existing SFCC programs are assuming usage described in smswehla's comment. Fixing this would break them, so leaving it as-is.