This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix missing X in 2 embed.fnc entries
[perl5.git] / ext / DynaLoader / dl_aix.xs
index e56fdc4..8e7d8ac 100644 (file)
@@ -12,6 +12,8 @@
  */
 
 #define PERLIO_NOT_STDIO 0
+#define PERL_EXT
+#define PERL_IN_DL_AIX_XS
 
 /*
  * On AIX 4.3 and above the emulation layer is not needed any more, and
@@ -720,9 +722,10 @@ dl_unload_file(libref)
     RETVAL
 
 void
-dl_find_symbol(libhandle, symbolname)
+dl_find_symbol(libhandle, symbolname, ign_err=0)
        void *          libhandle
        char *          symbolname
+        int            ign_err
        PREINIT:
         void *retv;
         CODE:
@@ -730,10 +733,11 @@ dl_find_symbol(libhandle, symbolname)
                libhandle, symbolname));
        retv = dlsym(libhandle, symbolname);
        DLDEBUG(2,PerlIO_printf(Perl_debug_log, "  symbolref = %x\n", retv));
-       ST(0) = sv_newmortal() ;
-       if (retv == NULL)
-           SaveError(aTHX_ "%s",dlerror()) ;
-       else
+       ST(0) = sv_newmortal();
+       if (retv == NULL) {
+            if (!ign_err)
+               SaveError(aTHX_ "%s", dlerror());
+       } else
            sv_setiv( ST(0), PTR2IV(retv));
 
 
@@ -759,11 +763,11 @@ dl_install_xsub(perl_name, symref, filename="$Package")
                                              XS_DYNAMIC_FILENAME)));
 
 
-char *
+SV *
 dl_error()
     CODE:
     dMY_CXT;
-    RETVAL = dl_last_error ;
+    RETVAL = newSVsv(MY_CXT.x_dl_last_error);
     OUTPUT:
     RETVAL
 
@@ -772,14 +776,15 @@ dl_error()
 void
 CLONE(...)
     CODE:
-    PERL_UNUSED_VAR(items);
     MY_CXT_CLONE;
 
+    PERL_UNUSED_VAR(items);
+
     /* 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);
+    MY_CXT.x_dl_last_error = newSVpvs("");
 
 #endif