Hello, Does anyone know where I can download cc compiler (not gcc). I am using SunOS 5.8 on Sun Blade machine. Thanks. ----- Original Message ----- From: Segher Boessenkool <segher@xxxxxxxxx> Date: Fri, 18 Jul 2003 04:05:42 +0200 To: Paolo Massimino <paolo.massimino@xxxxxxxxxxxx> Subject: Re: Executable shared object > Paolo Massimino wrote: > > Hi All! > > I have a problem. I need to build a sherd object that, like libc do, can > > print some information when you execute it like a normal executable. > > Anyone can help me ? > > Thank you > > Paolo > > Assuming you are on an ELF GNU/Linux system... > > Link normally, but add -Wl,-e,the_name_of_your_entry_point > for example this Makefile fragment: > > --- 8< --- > dop.so: dop.c > gcc -Wall -W -fPIC -shared -o dop.so dop.c -lc -Wl,-e,my_main > --- 8< --- > > and add code like this: > > --- 8< --- > const char my_interp[] __attribute__((section(".interp"))) = "/lib/ld.so.1"; > > void my_main(int argc, char **argv) > { > int i; > > printf("Called as:"); > for (i = 0; i < argc; i++) > printf(" %s", argv[i]); > printf("\n"); > > exit(0); > } > --- 8< --- > > > Have fun, > > Segher > >