Disable Error Detection Profiling for calls to Third Party libraries
Problem:
When a module is called under Error Dectection, all code within the module, including calls to third party modules are profiled. At times this can present a problem with time sensitive calls to these modules, whereby an attempted call will terminate if not completed within a specific time period.
Resolution:
There is a undocumented method to temporarily disable profiling on code segments that make this call.
In the source file which calls the third-party extension, add the following code:
// Numega Extension Library #include <NMAPILIB.h> #pragma comment(lib,"NMAPILIB.lib")
Modify the project settings to include this in the list of additional INCLUDE and LIB directories. Alter as appropriate if you install DevPartner to a non-default directory or drive.
"C:\Program Files (x86)\Micro Focus\DevPartner Studio\BoundsChecker\ERptApi\"
Finally, wrap the call to the third party code with the following:
// Turn off BoundsChecker API pre and post processing. bool fPreviousMode = Numega::NMSetHookMode ( false ) ;
// Call the third party code here.
// Restore BoundsChecker API processing to what it was before. Numega::NMSetHookMode ( fPreviousMode ) ;
This does not disable all Error Detection profiling and if during that third-party processing DLLs are loaded, performance may still be slow.
This should be used infrequently, as it deprives Error Detection of the profiling data information needed for accurate reporting.