Hi, have you a short sample code ? I am unable to set the destructor of a Object to a memberfunctionpointer !! And additional I am unable to execute the memberfunctionpointer to destroy the static Object. Thanks Michael
> -----Original Message----- > From: Erwin Rol [SMTP:[EMAIL PROTECTED]] > Sent: Friday, December 14, 2001 11:11 AM > To: [EMAIL PROTECTED] > Cc: RTLinux mailing list > Subject: Re: [rtl] sqrt implementation? (not the same old question > ;-) ) > > Hello Ivan, > > Last weekend i looked at the static C++ object problem you had. > It should be easy to solve (if you didn't already found out yerself). > > static C++ object have their constructor called on the first run of the > functions, and at that time also the destructor is registered with atexit > to > be called when the program terminates. Because you don't have atexit the > linker (or module loader) complains that it can't find the atexit symbol. > > The easy solution is to reserve a array of function pointers , and have a > atexit function that sets the destructor in that array. At unload time you > go > trough the array and call all registered destructors. Because you know the > number of static objects in your code the array can be fixed length, and > kmalloced at module load time (that way you can even set the size with a > module parameter). > > I hope this helps, > Erwin > > > > > Ivan Martinez wrote: > > > > Hello all, > > I'm trying to use the sqrt function in my C++ realtime module, > but I get the > > "unresolved symbol sqrt". I make the linkage as I saw in old postings: > > > > $(LD) -r -static -L/usr/lib -lm -lc -o app.o $(CRTBEGIN) rtmodule.or > > tmatrix.o $(CRTEND) > > > > I use extern "C" for includes too. > > I guess this has to do with the specific problems of C++ > realtime code, the > > same that prevented me from using POSIX I/O. So probably the easiest > solution > > will be to use my own sqrt. Does anybody know any implementation that I > could > > use or easily port?. Thank you. > > Regards, > > Ivan Martinez > > -- [rtl] --- > > To unsubscribe: > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] > > -- > > For more information on Real-Time Linux see: > > http://www.rtlinux.org/ > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] > -- > For more information on Real-Time Linux see: > http://www.rtlinux.org/ -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/