Start to make DynaLoader's Makefile.PL platform agnostic.
[p5sagit/p5-mst-13.2.git] / ext / DynaLoader / dl_mpeix.xs
index 7d27901..0c810ad 100644 (file)
@@ -3,6 +3,7 @@
  * Version: 2.1, 1996/07/25
  * Version: 2.2, 1997/09/25 Mark Bixby (markb@cccd.edu)
  * Version: 2.3, 1998/11/19 Mark Bixby (markb@cccd.edu)
+ * Version: 2.4, 2002/03/24 Mark Bixby (mark@bixby.org)
  */
 
 #include "EXTERN.h"
@@ -12,7 +13,7 @@
 #ifdef __GNUC__
 extern void HPGETPROCPLABEL(    int    parms,
                                 char * procname,
-                                int  * plabel,
+                                void * plabel,
                                 int  * status,
                                 char * firstfile,
                                 int    casesensitive,
@@ -30,13 +31,10 @@ typedef struct {
   char  filename[PATH_MAX + 3];
   } t_mpe_dld, *p_mpe_dld;
 
-static AV *dl_resolve_using = Nullav;
-
 static void
 dl_private_init(pTHX)
 {
     (void)dl_generic_private_init(aTHX);
-    dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI);
 }
 
 MODULE = DynaLoader     PACKAGE = DynaLoader
@@ -51,13 +49,13 @@ dl_load_file(filename, flags=0)
     PREINIT:
     char                buf[PATH_MAX + 3];
     p_mpe_dld           obj = NULL;
-    int                 i;
+
     CODE:
     DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dl_load_file(%s,%x):\n", filename,
 flags));
     if (flags & 0x01)
-        Perl_warn(aTHX_ "Can't make loaded symbols global on this platform while loading %s
-",filename);
+        Perl_warn(aTHX_ 
+"Can't make loaded symbols global on this platform while loading %s",filename);
     obj = (p_mpe_dld) safemalloc(sizeof(t_mpe_dld));
     memzero(obj, sizeof(t_mpe_dld));
     if (filename[0] != '/')
@@ -113,19 +111,36 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *      perl_name
     void *      symref
-    char *      filename
+    const char *      filename
     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(*)(pTHX_ CV *))symref,
-                                       filename)));
+    ST(0) = sv_2mortal(newRV((SV*)newXS_flags(perl_name,
+                                             (void(*)(pTHX_ CV *))symref,
+                                             filename, NULL,
+                                             XS_DYNAMIC_FILENAME)));
 
 char *
 dl_error()
     CODE:
-    RETVAL = LastError ;
+    dMY_CXT;
+    RETVAL = dl_last_error ;
     OUTPUT:
     RETVAL
 
+#if defined(USE_ITHREADS)
+
+void
+CLONE(...)
+    CODE:
+    MY_CXT_CLONE;
+
+    /* MY_CXT_CLONE just does a memcpy on the whole structure, so to avoid
+     * using Perl variables that belong to another thread, we create our 
+     * own for this thread.
+     */
+    MY_CXT.x_dl_last_error = newSVpvn("", 0);
+
+#endif
+
 # end.