DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);
rc = DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f); #if defined(NEED_LEADING_UNDERSCORE)  if (rc != NO_ERROR) { name++; DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f); } #endif
pr_FindSymbolInLib(PRLibrary *lm, const char *name){    void *f = NULL;    if (lm->staticTable != NULL) {        const PRStaticLinkTable* tp;        for (tp = lm->staticTable; tp->name; tp++) {            if (strcmp(name, tp->name) == 0) {                return (void*) tp->fp;            }        }        /*         ** If the symbol was not found in the static table then check if        ** the symbol was exported in the DLL... Win16 only!!        */#if !defined(WIN16) && !defined(XP_BEOS)        PR_SetError(PR_FIND_SYMBOL_ERROR, 0);        return (void*)NULL;#endif    }    #ifdef XP_OS2    DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);#endif  /* XP_OS2 */#if defined(WIN32) || defined(WIN16)    f = GetProcAddress(lm->dlh, name);#endif  /* WIN32 || WIN16 */#if defined(XP_MAC) || defined(XP_MACOSX)#if defined(NEED_LEADING_UNDERSCORE)#define SYM_OFFSET 1#else#define SYM_OFFSET 0#endif#if TARGET_CARBON    if (lm->bundle) {        CFStringRef nameRef = CFStringCreateWithCString(NULL, name + SYM_OFFSET, kCFStringEncodingASCII);        if (nameRef) {            f = CFBundleGetFunctionPointerForName(lm->bundle, nameRef);            CFRelease(nameRef);        }    }#endif    if (lm->connection) {        Ptr                 symAddr;        CFragSymbolClass    symClass;        Str255              pName;                PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Looking up symbol: %s", name + SYM_OFFSET));                PStrFromCStr(name + SYM_OFFSET, pName);        #if defined(XP_MACOSX)        f = (FindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL;#else        f = (NSFindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL;#endif        #if defined(XP_MACOSX)        /* callers expect mach-o function pointers, so must wrap tvectors with glue. */        if (f && symClass == kTVectorCFragSymbol) {            f = TV2FP(lm->wrappers, name + SYM_OFFSET, f);        }#endif                if (f == NULL && strcmp(name + SYM_OFFSET, "main") == 0) f = lm->main;    }#if defined(XP_MACOSX)    if (lm->image) {        NSSymbol symbol;        symbol = NSLookupSymbolInImage(lm->image, name,                 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND                 | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);        if (symbol != NULL)            f = NSAddressOfSymbol(symbol);        else            f = NULL;    }#endif#undef SYM_OFFSET#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;    }#endif#ifdef XP_UNIX#ifdef HAVE_DLL#ifdef USE_DLFCN    f = dlsym(lm->dlh, name);#elif defined(USE_HPSHL)    if (shl_findsym(&lm->dlh, name, TYPE_PROCEDURE, &f) == -1) {        f = NULL;    }#elif defined(USE_MACH_DYLD)    if (lm->dlh) {        NSSymbol symbol;        symbol = NSLookupSymbolInModule(lm->dlh, name);        if (symbol != NULL)            f = NSAddressOfSymbol(symbol);        else            f = NULL;    }#endif#endif /* HAVE_DLL */#endif /* XP_UNIX */    if (f == NULL) {        PR_SetError(PR_FIND_SYMBOL_ERROR, _MD_ERRNO());        DLLErrorInternal(_MD_ERRNO());    }    return f;}