ariovistus avatar ariovistus committed d6a3e9f

fix for winxp

Comments (0)

Files changed (1)

infrastructure/d/python_dll_windows_boilerplate.d

-/* This code is currently just a copy-n-paste from the Digital Mars DLL example
- * code at http://www.digitalmars.com/d/dll.html */
 
-version (Pyd_with_Tango) {
-    import tango.sys.windows.minwin;
-} else {
-    import std.c.windows.windows;
-}
+// Public Domain
 
-HINSTANCE g_hInst;
+import std.c.windows.windows;
+import core.sys.windows.dll;
 
-extern (C)
-{
-  void gc_init();
-  void gc_term();
-  void _minit();
-  void _moduleCtor();
-  void runModuleUnitTests();
-}
+__gshared HINSTANCE g_hInst;
 
 extern (Windows)
 BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
 {
-  switch (ulReason)
-  {
-    case DLL_PROCESS_ATTACH:
-      gc_init(); // initialize GC
-      _minit(); // initialize module list
-      _moduleCtor(); // run module constructors
-      runModuleUnitTests(); // run module unit tests
+    switch (ulReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            g_hInst = hInstance;
+            dll_process_attach( hInstance, true );
+            break;
 
-      break;
+        case DLL_PROCESS_DETACH:
+            dll_process_detach( hInstance, true );
+            break;
 
-    case DLL_PROCESS_DETACH:
-      gc_term(); // shut down GC
-      break;
+        case DLL_THREAD_ATTACH:
+            dll_thread_attach( true, true );
+            break;
 
-    case DLL_THREAD_ATTACH:
-    case DLL_THREAD_DETACH:
-      // Multiple threads not supported yet
-      return false;
-      default:
-  }
-  g_hInst=hInstance;
-  return true;
+        case DLL_THREAD_DETACH:
+            dll_thread_detach( true, true );
+            break;
+
+	default:
+	    assert(0);
+    }
+
+    return true;
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.