XPLM_API int XPLMIsDataRefGood( XPLMDataRef inDataRef);
This function returns true if the passed in handle is a valid dataref that is not orphaned.
Note: there is normally no need to call this function; datarefs returned by XPLMFindDataRef remain valid (but possibly orphaned) unless there is a complete plugin reload (in which case your plugin is reloaded anyway). Orphaned datarefs can be safely read and return 0. Therefore you never need to call XPLMIsDataRefGood to ‘check’ the safety of a dataref. (XPLMIsDatarefGood performs some slow checking of the handle validity, so it has a perormance cost.)