Wrap the $VERSION initialization of DynaLoader in a BEGIN block
[p5sagit/p5-mst-13.2.git] / ext / DynaLoader / dl_mac.xs
index dd1ddfa..826caf2 100644 (file)
@@ -34,9 +34,8 @@ typedef struct {
 
 #define dl_connections (dl_cxtx.x_connections)
 
-static void terminate(void)
+static void terminate(pTHX_ void *ptr)
 {
-    dTHX;
     dMY_CXT;
     int size = GetHandleSize((Handle) dl_connections) / sizeof(ConnectionID);
     HLock((Handle) dl_connections);
@@ -79,7 +78,7 @@ dl_load_file(filename, flags=0)
        dMY_CXT;
        if (!dl_connections) {
            dl_connections = (ConnectionID **)NewHandle(0);
-           atexit(terminate);
+           call_atexit(terminate, (void*)0);
        }
         PtrAndHand((Ptr) &connID, (Handle) dl_connections, sizeof(ConnectionID));
        RETVAL = connID;
@@ -131,7 +130,10 @@ dl_install_xsub(perl_name, symref, filename="$Package")
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_install_xsub(name=%s, symref=%x)\n",
                perl_name, symref));
-    ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename)));
+    ST(0) = sv_2mortal(newRV((SV*)newXS_flags(perl_name,
+                                             (void(*)(pTHX_ CV *))symref,
+                                             filename, NULL,
+                                             XS_DYNAMIC_FILENAME)));
 
 
 char *