Update of /cvsroot/mahogany/M/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8554/include
Modified Files:
MModule.h
Log Message:
added MMODULE_CLEANUP to make it possible to call a function on module unload
Index: MModule.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MModule.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -b -u -2 -r1.60 -r1.61
--- MModule.h 11 Jul 2004 00:07:17 -0000 1.60
+++ MModule.h 2 Dec 2004 08:04:43 -0000 1.61
@@ -28,4 +28,6 @@
#include "Mversion.h" // for M_VERSION_MAJOR &c
+#include "MAtExit.h"
+
// ----------------------------------------------------------------------------
// macros
@@ -79,4 +81,7 @@
#define MMODULE_GETPROPERTY_FUNCTION _T("GetMModuleProperties")
+/// Name of the function called to do module cleanup
+#define MMODULE_CLEANUP_FUNCTION _T("CleanupMModule")
+
// ----------------------------------------------------------------------------
// constants
@@ -296,4 +301,6 @@
Each module DLL must implement a function CreateMModule of this
type which will be called to initialise it. That function must
+ return the new object representing this module.
+
@param version_major major version number of Mahogany
@param version_minor minor version number of Mahogany
@@ -310,7 +317,5 @@
int *errorCode);
- /** Function to retreieve info from a module DLL. A module DLL may
- export such function, although it is not necessary if it has a
- matching .mmd file.
+ /** Function returning information about this module.
The function should return the name, description and version of the
@@ -318,4 +323,12 @@
*/
typedef const ModuleProperty *(* MModule_GetModulePropFuncType)(void);
+
+ /**
+ Function called to do module cleanup.
+
+ A module may not have this function in which case nothing is done when it
+ is unloaded.
+ */
+ typedef void (*MModule_CleanUpFuncType)();
}
//@}
@@ -343,6 +356,13 @@
} \
} gs_moduleInitializerFor##ClassName;
+
+# define MMODULE_CLEANUP(func) MRunFunctionAtExit moduleCleanup(func);
#else // !USE_MODULES_STATIC
# define MMODULE_INITIALISE(ClassName, Name, Interface, Description, Version)
+# define MMODULE_CLEANUP(func) \
+ extern "C" \
+ { \
+ MDLLEXPORT void CleanupMModule() { (func)(); }
+ }
#endif // USE_MODULES_STATIC/!USE_MODULES_STATIC
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates