XPLMShareData

XPLM_API int        XPLMShareData(
                         const char *         inDataName,
                         XPLMDataTypeID       inDataType,
                         XPLMDataChanged_f    inNotificationFunc,
                         void *               inNotificationRefcon);

This routine connects a plug-in to shared data, creating the shared data if necessary. inDataName is a standard path for the dataref, and inDataType specifies the type. This function will create the data if it does not exist. If the data already exists but the type does not match, an error is returned, so it is important that plug-in authors collaborate to establish public standards for shared data.

If a notificationFunc is passed in and is not NULL, that notification function will be called whenever the data is modified. The notification refcon will be passed to it. This allows your plug-in to know which shared data was changed if multiple shared data are handled by one callback, or if the plug-in does not use global variables.

A one is returned for successfully creating or finding the shared data; a zero if the data already exists but is of the wrong type.