From: Douglas Lankshear Date: Tue, 3 Mar 1998 10:46:13 +0000 (-0800) Subject: [asperl] added AS patch#10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26b3385cfa7a4193b7fdcd1e1e62a8894e9d9198;p=p5sagit%2Fp5-mst-13.2.git [asperl] added AS patch#10 Message-Id: <01BD4691.963D1670.dougl@ActiveState.com> Subject: [PATCH] Here's a patch to win32/dl_win32.xs that is a fix for the lookup of statically linked modules. -- Doug p4raw-id: //depot/asperl@760 --- diff --git a/win32/dl_win32.xs b/win32/dl_win32.xs index a8d10e1..2f330b4 100644 --- a/win32/dl_win32.xs +++ b/win32/dl_win32.xs @@ -41,12 +41,38 @@ dl_private_init(CPERLarg) (void)dl_generic_private_init(THIS); } +/* + This function assumes the list staticlinkmodules + will be formed from package names with '::' replaced + with '/'. Thus Win32::OLE is in the list as Win32/OLE +*/ static int dl_static_linked(char *filename) { char **p; + char* ptr; + static char subStr[] = "/auto/"; + char szBuffer[MAX_PATH]; + + /* change all the '\\' to '/' */ + strcpy(szBuffer, filename); + for(ptr = szBuffer; ptr = strchr(ptr, '\\'); ++ptr) + *ptr = '/'; + + /* delete the file name */ + ptr = strrchr(szBuffer, '/'); + if(ptr != NULL) + *ptr = '\0'; + + /* remove leading lib path */ + ptr = strstr(szBuffer, subStr); + if(ptr != NULL) + ptr += sizeof(subStr)-1; + else + ptr = szBuffer; + for (p = staticlinkmodules; *p;p++) { - if (strstr(filename, *p)) return 1; + if (strstr(ptr, *p)) return 1; }; return 0; }