Mailing List archive

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

[vdr] Re: VDR developer version 1.1.2





Andreas Schultz wrote:

>On Tuesday 14 May 2002 09:08, Mirko Günther wrote:
>
>>I've a litle problem with my plugin and I don't know, what goes wrong.
>>
>>1) I want use a abstract class with one virtual function. but after
>>linking and start vdr, I get an errormessage that this abstract virtual
>>function is a undefined symbol. what do I wrong.
>>
>
>you defined the abstrace virtual function like this:
>
>virtual vfunction(...) = 0;
>
>right?
>
 Yes.

>
>>2) When I difine this function only as virtual with a body, this message
>>don't come. but when I sccess (?) from this class a new class, overwrite
>>the virtual function and store a object of the 2nd class in a pointer of
>>the baseclass, I can't call the virtual function.
>>I always get an Segmentionfault. I've try to gebug with gdb and it
>>seems, that the call wants to jump to address NULL an not to the
>>function address. what goes wrong?
>>
>>I hope you understant me... In german I can explain my problem better.
>>
>
>I think i understand, but i would be better to have a look at your source.
>It certainly sounds, as if your constructor isn't been called. Also, some gcc 
>versions are known to produce code that doesn't work when used in shared 
>libraries.
>
>Andreas
>
Hmmm... the plugin-interface also works with abstract virtual functions. 
and the constructor is called. :o)


Ok... the Code is'

1st class:

class cComponent
{
 private:
  cInterface *interface;
 protected:
  virtual void Paint(void)  =  0;       

 public:
  cComponent(cInterface*);
  virtual ~cComponent();

   //... little more Code
};//class cComponent

2nd Class

class tProgressBar: public cComponent
{
 private:
  int x,y, current, total;

 protected:
  virtual void Paint();

 public:
  tProgressBar(cInterface* interface,int X, int Y, int Width = 200, int 
Height = 20, int Current=0, int Total=100);
  virtual ~tProgressBar();

  void Draw();
  void setTotal  (int Total);
  void setCurrent(int Current);
};//class cProgressBar

the calls
 tProgressBar* t  =  new tProgressBar(Interface);
cComponent* d = t;
d->Paint();

gets an Segmentionfault.

The Classes do nothing in there other functions.

I use: gcc version 2.95.3 20010315 (SuSE)



Home | Main Index | Thread Index