dl_dlopen.xs.ed   [plain text]


/^dl_load_file/a
.
/SaveError(aTHX_ "%s",dlerror())/c
    {
	char *error = dlerror();
#ifdef __LP64__
	char *cp;
	char *err = NULL;
#endif /* __LP64__ */
	if (!error) error = "Unknown dlopen error";
#ifdef __LP64__
	else if ((cp = strstr(error, ": no matching architecture in universal wrapper")) != NULL) {
	    char *p = strchr(error, '\t');
	    if (p && ++p < cp) {
		    asprintf(&err, "%.*s: no appropriate 64-bit architecture (see \"man perl\" for running in 32-bit mode)", (cp - p), p);
		    if (err) error = err;
	    }
	}
#endif /* __LP64__ */
	SaveError(aTHX_ "%s", error);
#ifdef __LP64__
	if (err) free(err);
#endif /* __LP64__ */
    }
.
w