Fix for bug #81659, r=pinkerton, sr=scc. MOZILLA_0_9_2_BRANCH MOZILLA_0_9_2_1_SRC_RELEASE Netscape61_RELEASE
authorbeard%netscape.com
Thu, 19 Jul 2001 19:32:34 +0000
branchMOZILLA_0_9_2_BRANCH
changeset 1992 2c6071edb853b799a127174d62533172a1e6b276
parent 1984 0c8a785d54d00ccda500e8177163b4ee3249c97c
push idunknown
push userunknown
push dateunknown
reviewerspinkerton, scc
bugs81659
Fix for bug #81659, r=pinkerton, sr=scc.
pr/src/linking/prlink.c
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -96,16 +96,18 @@ struct PRLibrary {
 #endif
 
 #ifdef XP_MAC
     CFragConnectionID           dlh;
 
 #if TARGET_CARBON
     CFBundleRef                 bundle;
 #endif
+
+    Ptr                         main;
 #endif
 
 #ifdef XP_UNIX
 #if defined(USE_HPSHL)
     shl_t                       dlh;
 #elif defined(USE_MACH_DYLD)
     NSModule                    dlh;
 #else
@@ -584,17 +586,16 @@ pr_LoadLibraryByPathname(const char *nam
             lm->staticTable = (*pfn)();
         }
     }
 #endif /* WIN32 || WIN16 */
 
 #if defined(XP_MAC) && TARGET_RT_MAC_CFM
     {
     OSErr                 err;
-    Ptr                   main;
     CFragConnectionID     connectionID;
     Str255                errName;
     Str255                pName;
     char                  cName[64];
     const char*           libName;
         
     /*
      * Algorithm: The "name" passed in could be either a shared
@@ -631,20 +632,20 @@ pr_LoadLibraryByPathname(const char *nam
         PStrFromCStr(name, pName);
     
         /*
          * beard: NSGetSharedLibrary was so broken that I just decided to
          * use GetSharedLibrary for now.  This will need to change for
          * plugins, but those should go in the Extensions folder anyhow.
          */
 #if 0
-        err = NSGetSharedLibrary(pName, &connectionID, &main);
+        err = NSGetSharedLibrary(pName, &connectionID, &lm->main);
 #else
         err = GetSharedLibrary(pName, kCompiledCFragArch, kReferenceCFrag,
-                &connectionID, &main, errName);
+                &connectionID, &lm->main, errName);
 #endif
         if (err != noErr)
         {
             oserr = err;
             PR_DELETE(lm);
             goto unlock;    
         }
         
@@ -682,17 +683,17 @@ pr_LoadLibraryByPathname(const char *nam
         {
             oserr = err;
             PR_DELETE(lm);
             goto unlock;
         }
 
         /* Finally, try to load the library */
         err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name, 
-                              kLoadCFrag, &connectionID, &main, errName);
+                              kLoadCFrag, &connectionID, &lm->main, errName);
 
         memcpy(cName, fileSpec.name + 1, fileSpec.name[0]);
         cName[fileSpec.name[0]] = '\0';
         libName = cName;
         
         if (err != noErr)
         {
 #if TARGET_CARBON
@@ -1172,16 +1173,18 @@ pr_FindSymbolInLib(PRLibrary *lm, const 
     {
         Ptr                 symAddr;
         CFragSymbolClass    symClass;
         Str255              pName;
             
         PStrFromCStr(name, pName);    
         
         f = (NSFindSymbol(lm->dlh, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL;
+        
+        if (f == NULL && strcmp(name, "main") == 0) f = lm->main;
     }
 #endif /* XP_MAC */
 
 #ifdef XP_BEOS
     if( B_NO_ERROR != get_image_symbol( (image_id)lm->dlh, name, B_SYMBOL_TYPE_TEXT, &f ) ) {
 
 	f = NULL;
     }