X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FDynaLoader%2Fdl_next.xs;h=e5774c0ac32d51ae0f6dfae9645ce293c2154c07;hb=dcfdccf94c5ada3342776b740fd487168bef3ca3;hp=405082664d0653d07eaf94457025279f795d3e3f;hpb=cdc73a103e56840003cb817a381323974e4b9832;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/DynaLoader/dl_next.xs b/ext/DynaLoader/dl_next.xs index 4050826..e5774c0 100644 --- a/ext/DynaLoader/dl_next.xs +++ b/ext/DynaLoader/dl_next.xs @@ -8,11 +8,13 @@ */ /* - And Gandalf said: 'Many folk like to know beforehand what is to - be set on the table; but those who have laboured to prepare the - feast like to keep their secret; for wonder makes the words of - praise louder.' -*/ + * And Gandalf said: 'Many folk like to know beforehand what is to + * be set on the table; but those who have laboured to prepare the + * feast like to keep their secret; for wonder makes the words of + * praise louder.' + * + * [p.970 of _The Lord of the Rings_, VI/v: "The Steward and the King"] + */ /* Porting notes: @@ -85,7 +87,7 @@ static void TranslateError { "%s(%d): Object Image Load Failure\n", "%s(%d): Object Image Load Success\n", - "%s(%d): Not an recognisable object file\n", + "%s(%d): Not a recognisable object file\n", "%s(%d): No valid architecture\n", "%s(%d): Object image has an invalid format\n", "%s(%d): Invalid access (permissions?)\n", @@ -156,13 +158,14 @@ static void TransferError(NXStream *s) { char *buffer; int len, maxlen; + dTHX; dMY_CXT; if ( dl_last_error ) { Safefree(dl_last_error); } NXGetMemoryBuffer(s, &buffer, &len, &maxlen); - New(1097, dl_last_error, len, char); + Newx(dl_last_error, len, char); strcpy(dl_last_error, buffer); } @@ -181,6 +184,7 @@ static char *dlopen(char *path, int mode /* mode is ignored */) char *result; char **p; STRLEN n_a; + dTHX; dMY_CXT; /* Do not load what is already loaded into this process */ @@ -299,13 +303,14 @@ 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 * @@ -316,4 +321,20 @@ dl_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); + dl_resolve_using = get_av("DynaLoader::dl_resolve_using", GV_ADDMULTI); + +#endif + # end.