Re: Static Library startup

2011-12-05 Thread Dave Martin
On Mon, Dec 05, 2011 at 04:47:08PM +, Richard Sandiford wrote: > Richard Sandiford writes: > > Dave Martin writes: > >> Another way of doing a similar thing is to mark __mylib_constructor > >> as undefined in all the objects that make up the library. > >> > >> Unfortunately, there seems to be

Re: Static Library startup

2011-12-05 Thread Richard Sandiford
Richard Sandiford writes: > Dave Martin writes: >> Another way of doing a similar thing is to mark __mylib_constructor >> as undefined in all the objects that make up the library. >> >> Unfortunately, there seems to be no obvious way of doing that: the >> assembler generates undefined symbol refe

Re: Static Library startup

2011-12-05 Thread Richard Sandiford
Dave Martin writes: > Another way of doing a similar thing is to mark __mylib_constructor > as undefined in all the objects that make up the library. > > Unfortunately, there seems to be no obvious way of doing that: the > assembler generates undefined symbol references automatically for > unresol

Re: Static Library startup

2011-12-05 Thread Ulrich Weigand
Tom Gall wrote: > For shared libs one can define and use something like: > > void __attribute__ ((constructor)) my_init(void); > void __attribute__ ((destructor)) my_fini(void); > > Which of course allows your lib to run code just after the library is > loaded and just before the library is going

Re: Static Library startup

2011-12-05 Thread Dave Martin
> On Mon, Dec 5, 2011 at 1:40 AM, Tom Gall wrote: > > I probably know the answer to this already but ... > > > > For shared libs one can define and use something like: > > > > void __attribute__ ((constructor)) my_init(void); > > void __attribute__ ((destructor)) my_fini(void); > > > > Which of co

Re: Static Library startup

2011-12-05 Thread Mans Rullgard
On 4 December 2011 17:40, Tom Gall wrote: > I probably know the answer to this already but ... > > For shared libs one can define and use something like: > > void __attribute__ ((constructor)) my_init(void); > void __attribute__ ((destructor)) my_fini(void); > > Which of course allows your lib to

Re: Static Library startup

2011-12-05 Thread Kito Cheng
Here is some triky way for this problem, you can put the constructor and destructor to the source file which contain necessary function call in your libraries to enforce the linker to archive your constructor and destructor. However if this solution is not work for your situation, you can apply th

Static Library startup

2011-12-04 Thread Tom Gall
I probably know the answer to this already but ... For shared libs one can define and use something like: void __attribute__ ((constructor)) my_init(void); void __attribute__ ((destructor)) my_fini(void); Which of course allows your lib to run code just after the library is loaded and just befor