Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Quant-X Alpha Linux Support <stefan@sime.com>
To: Eric Ding <ericding@applix.com>
Cc: axp-list@redhat.com
Subject: Re: BUG: probs with resolving functions in shared library
Date: Thu, 6 Aug 1998 14:59:42 +0200	[thread overview]
Message-ID: <199808061259.OAA00370@stefan.sime.com> (raw)
In-Reply-To: <yv4u33qu95j.fsf@tuxedo.applix.com> (message from Eric Ding on 05 Aug 1998 22:38:32 -0400)

Hi Eric !

> thanks for the tip; unfortunately, we *do* need to use the -export-dynamic
> flag with our main executable, so this helps but doesn't solve the problem
> sufficiently to get Applixware for Linux/Alpha any closer to running.  :)

I think the problem is in your head. ;-}
The solution is easy (correct me if not...).
You only must make shure that the main program does **not** need -export-dynamic.
That's really easy (at least here, maybe not for you...)

a) make the main-program a shared library (this step needs (here) no code changes, only
   affects linking stage).

b) use a stub (linked without -export-dynamic) to start the main program (library).

c) run the stub.

Here a sample stub:

/* start stub.c */

#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char **argv) {
	void *handle;
	int (*real_main)(int, char **);
	int rc;

	if((handle = dlopen("./libapplix.so", RTLD_NOW)) == NULL) {
	  fprintf(stderr, "error dlopen: %s\n", dlerror());
	  exit(1);
	}
	if((real_main = dlsym(handle, "main")) == NULL) {
	  fprintf(stderr, "error dlsym: %s\n", dlerror());
	  exit(1);
	}
	rc = (*real_main)(argc, argv);
	dlclose(handle);
	return(rc);
}

/* end stub.c */

Hope it helps (maybe this time...)


> 
> Eric
> 
> Quant-X Alpha Linux Support <stefan@sime.com> writes:
> 
> > I don't know if it helps:
> > 
> > ld -shared -Bdynamic --noinhibit-exec -o libtest2.so test2.o test3.o
> > 
> > works here as expected. (The difference is only that I'm using
> > -Bdynamic instead of -Bsymbolic) 
> > 
> > It is a bug. But ok so.
> > If you want -Bdynamic work as the specs say, you need to compile the main
> > program (!) with -Xlinker -export-dynamic. If you do this, you
> > get the "OOPS!".
> -- 
> Software Development Engineer / ericding@applix.com               <><
> Applix, Inc. / 112 Turnpike Road / Westboro MA 01581-2842
> TEL: (508) 870-0300 x284 / FAX: (508) 366-4873
> 
> -- 
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com
> 

  ciao -
    Stefan

-- 

Quant-X Service &                         Ph:  (+43) 4212 6004-0
Consulting Ges.m.b.H.                     Fax: (+43) 4212 600420
http://www.quant-x.com                    Email: support@quant-x.com


  reply	other threads:[~1998-08-06 13:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-05 22:48 BUG: probs with resolving functions in shared library Quant-X Alpha Linux Support
1998-08-06  2:38 ` Eric Ding
1998-08-06 12:59   ` Quant-X Alpha Linux Support [this message]
1998-08-06 16:30     ` Eric Ding
1998-08-06 21:24       ` Quant-X Alpha Linux Support
  -- strict thread matches above, loose matches on Subject: below --
1998-08-05 16:16 Eric Ding
1998-08-08 22:29 ` Richard Henderson
1998-08-10 15:54   ` Eric Ding
1998-08-10 17:52     ` Richard Henderson
1998-08-10 19:51       ` Eric Ding
1998-08-12 17:07   ` Eric Ding
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox