Objects are passed back and forth across the API, and in general, it is the thing that passes the data that is responsible for destroying it. For example the property set handle in the
is managed by the host.
There are a few explicit exceptions to this. For example, when an image effect asks for an image from a host it is passed back a property set handle which represents the image. That handle needs to later be disposed of by an effect, by an explicit function call back to the host. These few exceptions are documented with the suite functions that access the object.
A special case is made for strings. Strings are considered to be of two types, value strings and label strings. A label string is any string used by OFX to name a property or type. A value string is generally a string value of a property.
More specifically, a label string is a string passed across the API as one of the following...
paramTypeargument to OfxParameterSuiteV1::paramDefine , but not the
Label strings are considered to be static constant strings. When passed across the API the host/plug-in receiving the string neither needs to duplicate nor free the string, it can simply retain the orginal pointer passed over and use that in future, as it will not change. A host must be aware that when it unloads a plug-in all such pointers will be invalid, and be prepared to cope with such a situation.
A value string is a string passed across the API as one of the following...
char *argument to any other function.
Value strings have no assumptions made about them. When one is passed across the API, the thing that passed the string retains ownership of it. The thing getting the string is not responsible for freeing that string. The scope of the string's validity is until the next OFX API function is called. For example, within a plugin
// pointer to store the returned value of the host name char *returnedHostName; // get the host name propSuite->propGetString(hostHandle, kOfxPropName, 0, &returnedHostName); // now make a copy of that before the next API call, as it may not be valid after it char *hostName = strdup(returnedHostName); paramSuite->getParamValue(instance, "myParam", &value);