From b23a755d6f222b3163b98cfc324a05e9fe466a99 Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Fri, 20 Aug 1999 16:21:35 +0000 Subject: Merged with HEAD from 8/18 or so. --- pr/src/linking/prlink.c | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index 78d84486..0592c05c 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -638,25 +638,6 @@ PR_LoadLibrary(const char *name) } #endif -#ifdef XP_BEOS - { - image_id h = load_add_on( name ); - - if( h == B_ERROR || h <= 0 ) { - - h = 0; - result = NULL; - PR_DELETE( lm ); - lm = NULL; - goto unlock; - } - lm->name = strdup(name); - lm->dlh = (void*)h; - lm->next = pr_loadmap; - pr_loadmap = lm; - } -#endif - #ifdef XP_UNIX #ifdef HAVE_DLL { @@ -687,6 +668,36 @@ PR_LoadLibrary(const char *name) #endif /* XP_UNIX */ lm->refCount = 1; + +#ifdef XP_BEOS + { + image_info info; + int32 cookie = 0; + image_id h = B_ERROR; + + while(get_next_image_info(0, &cookie, &info) == B_OK) + if(strcmp(name, info.name + strlen(info.name) - strlen(name)) == 0) { + h = info.id; + lm->refCount++; /* it has been already loaded implcitly, so pretend it already had a control structure and ref */ + } + + if(h == B_ERROR) + h = load_add_on( name ); + + if( h == B_ERROR || h <= 0 ) { + h = 0; + result = NULL; + PR_DELETE( lm ); + lm = NULL; + goto unlock; + } + lm->name = strdup(name); + lm->dlh = (void*)h; + lm->next = pr_loadmap; + pr_loadmap = lm; + } +#endif + result = lm; /* success */ PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", lm->name)); -- cgit v1.2.1