Integrate change #12820 from macperl to maint and blead;
Jarkko Hietaniemi [Fri, 2 Nov 2001 21:56:36 +0000 (21:56 +0000)]
Fix up (dynaloading) to work properly with multiplicity

p4raw-link: @12820 on //depot/maint-5.6/macperl: 1254e164e862d84b4c35d69c6880819df23c4acd

p4raw-id: //depot/perl@12823
p4raw-integrated: from //depot/maint-5.6/macperl@12818 'merge in'
ext/DynaLoader/dl_mac.xs (@12699..)

ext/DynaLoader/dl_mac.xs

index dd1ddfa..6c624e7 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;