HLTError("Could not create a new object of type '%s'.", classname);
}
- // Matthias 2009-11-03: temporarily disabled, on some systems the warning
- // is interpreted an an error, so we have a litle problem with root
- // HLT/trigger/AliHLTGlobalTriggerWrapper.cxx:122: error: ISO C++ forbids
- // casting between pointer-to-function and pointer-to-object
- //G__set_errmsgcallback(reinterpret_cast<void*>(AliHLTOnErrorInCINT));
+ // The following is a workaround for casting void* to void (*)(), i.e. a pointer to object to
+ // a pointer to function. Unfortunately the G__set_errmsgcallback routine interface is defined
+ // using a pointer to object so this workaround is necessary.
+ // We check that the two types are the same size. If they are not then such an operation is
+ // unsafe on the platform on which we are running and will not be performed.
+ union
+ {
+ void* fPtr;
+ void (*fFuncPtr)(char*);
+ };
+ fFuncPtr = AliHLTOnErrorInCINT;
+ if (sizeof(fPtr) == sizeof(fFuncPtr))
+ {
+ G__set_errmsgcallback(fPtr);
+ }
+ else
+ {
+ HLTWarning("On this platform a pointer to function and pointer to object are different sizes."
+ " For this reason we cannot use the G__set_errmsgcallback CINT API call in a safe way so all"
+ " error messages generated by CINT will not be captured or logged in the HLT system."
+ );
+ }
}