DLLEXPORT int xlAutoClose() { static XLOPER xDll; try { Excel(xlGetName, &xDll, 0); unregisterOhFunctions(xDll); Excel(xlFree, 0, 1, &xDll); return 1; } catch (const std::exception &e) { std::ostringstream err; err << "Error unloading AddinXlHw: " << e.what(); Excel(xlcAlert, 0, 1, TempStrStl(err.str())); Excel(xlFree, 0, 1, &xDll); return 0; } catch (...) { Excel(xlFree, 0, 1, &xDll); return 0; } }
DLLEXPORT int xlAutoClose() { static XLOPER xDll; try { Excel(xlGetName, &xDll, 0); #ifdef XLL_STATIC // Unregister ObjectHandler functions unregisterOhFunctions(xDll); #endif // Unregister QuantLib functions unregisterSBSAFunctions(xDll); // Deallocate the Enumeration Registry QuantLibAddin::unregisterEnumerations(); Excel(xlFree, 0, 1, &xDll); return 1; } catch (const std::exception &e) { std::ostringstream err; err << "Error unloading sbsa xll objects: " << e.what(); Excel(xlcAlert, 0, 1, TempStrStl(err.str())); Excel(xlFree, 0, 1, &xDll); return 0; } catch (...) { Excel(xlFree, 0, 1, &xDll); return 0; } }
DLLEXPORT int xlAutoClose() { static XLOPER xDll; try { // empty the ObjectHandler repository //Excel(xlUDF, 0, 1, TempStrNoSize("\x1c""ohRepositoryDeleteAllObjects")); // unregister the addin functions Excel(xlGetName, &xDll, 0); unregisterOhFunctions(xDll); Excel(xlFree, 0, 1, &xDll); return 1; } catch (const std::exception &e) { Excel(xlFree, 0, 1, &xDll); std::ostringstream err; err << "Error unloading ObjectHandler: " << e.what(); Excel(xlcAlert, 0, 1, TempStrStl(err.str())); return 0; } catch (...) { Excel(xlFree, 0, 1, &xDll); return 0; } }