aboutsummaryrefslogtreecommitdiff
path: root/pd/portmidi/pm_win/pmdll.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-15 00:57:02 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-15 00:57:02 +0000
commit90d5b8b4a064420d74678654e94ea4755b377f21 (patch)
tree5d49b9f6ae17b75c98ad1a8302a0d84f1d99f75b /pd/portmidi/pm_win/pmdll.c
parent59ad9e9cf0a72b31f8bfd371cb97536ed4d4fe61 (diff)
checking in missing files on behalf of Miller (cleared it with him first). The files are from portmidi17nov04.zip
svn path=/trunk/; revision=4216
Diffstat (limited to 'pd/portmidi/pm_win/pmdll.c')
-rw-r--r--pd/portmidi/pm_win/pmdll.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/pd/portmidi/pm_win/pmdll.c b/pd/portmidi/pm_win/pmdll.c
new file mode 100644
index 00000000..c3acba33
--- /dev/null
+++ b/pd/portmidi/pm_win/pmdll.c
@@ -0,0 +1,49 @@
+/*
+====================================================================
+DLL to perform action when program shuts down
+====================================================================
+*/
+
+#include "windows.h"
+#include "pmdll.h"
+
+static close_fn_ptr_type close_function = NULL;
+
+
+DLL_EXPORT pm_set_close_function(close_fn_ptr_type close_fn_ptr)
+{
+ close_function = close_fn_ptr;
+}
+
+
+static void Initialize( void ) {
+ return;
+}
+
+static void Terminate( void ) {
+ if (close_function) {
+ (*close_function)();
+ }
+}
+
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, //DLL module handle
+ DWORD fdwReason, //for calling function
+ LPVOID lbpvReserved)//reserved
+{
+ switch(fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ /* when DLL starts, run this */
+ Initialize();
+ break;
+ case DLL_PROCESS_DETACH:
+ /* when DLL ends, this run (note: verified this run */
+ Terminate();
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+