[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [rtl] Update on C++ delete problem



Attached is a experimental module a wrote fro RTAI (so it is unlikely it
compiles with RTLinux, but might still be of use as reference)

- Erwin


On Mon, 2001-10-15 at 20:00, sseeger@stellartec.com wrote:
> Have it print the pointer 'a' as a %d using rtl_printf. See if 'a' is even
> being assigned an address.
> 
> Do it like this:
> 
> AbstractBaseClass *a;
> 
> a = new AbstractBaseClass();
> rtl_printf("%d\n",a);
> 
> That'll tell you if a is even being set. If so, delete should frankly work.
> I didn't realize you were trying to do cpp inside RTL. I forgot what list I
> was on, heh. I haven't ever had a need to do CPP inside RTL so I can't help
> beyond that. That's why I suggest seeing if a is even assigned, since maybe
> that'll tell you if the new operator is working correctly.
> 
> Steve
> 
> >-----Original Message-----
> >From: owner-rtl@fsmlabs.com [mailto:owner-rtl@fsmlabs.com]On Behalf Of
> >David Hamilton
> >Sent: Monday, October 15, 2001 4:24 AM
> >To: 'rtl@fsmlabs.com'
> >Subject: [rtl] Update on C++ delete problem
> >
> >
> >I found out some more on my C++ delete problem.
> >
> >I am linking to the delete function defined in rtl_cpp.h.
> >A simple delete can work from a RTLinux thread.
> >
> >BUT
> >the following does not work....
> >
> >class AbstractBaseClass
> >{
> > public :
> >  AbstractBaseClass() {}
> >  virtual ~AbstractBaseClass() {}
> >
> >  virtual void do_sth() = 0;
> >};
> >
> >class ChildClass : public AbstractBaseClass
> >{
> >  public :
> >  ChildClass() {}
> >  virtual ~ChildClass() {}
> >
> >  void do_sth() {}
> >};
> >
> >void main()
> >{
> >  AbstractBaseClass* a = new ChildClass;
> >
> >  delete a;
> >}
> >
> >i.e. Something to do with dynamic resolution of function call.
> >David
> >-- [rtl] ---
> >To unsubscribe:
> >echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> >echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> >--
> >For more information on Real-Time Linux see:
> >http://www.rtlinux.org/
> >
> >
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/

rtai_cpp.tgz

PGP signature