summaryrefslogtreecommitdiff
path: root/source/LCDriverEntry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/LCDriverEntry.cpp')
-rw-r--r--source/LCDriverEntry.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/LCDriverEntry.cpp b/source/LCDriverEntry.cpp
new file mode 100644
index 0000000..91bd189
--- /dev/null
+++ b/source/LCDriverEntry.cpp
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (C) ST-Ericsson SA 2011
+ * License terms: 3-clause BSD license
+ ******************************************************************************/
+
+#include "LCDriverMethods.h"
+#include "Buffers.h"
+
+void destroy(void);
+
+#ifdef _WIN32
+BOOL APIENTRY DllMain(HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved)
+{
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH:
+ break;
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ destroy();
+ break;
+ }
+
+ return TRUE;
+}
+#else
+void __attribute__((destructor)) DllMain(void)
+{
+ destroy();
+}
+#endif
+
+//***********************************************************************************************
+// Name: destroy()
+// Desc: Destroy any remaining buffer data.
+//**********************************************************************************************/
+void destroy(void)
+{
+ Buffers::ReleaseAllBulkFiles();
+ LcmInterface::CloseLCMLibrary();
+}