chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] easyffi virtual=0 methods


From: Carlos Pita
Subject: Re: [Chicken-users] easyffi virtual=0 methods
Date: Sun, 11 Mar 2007 20:19:20 -0300

I was thinking a bit more about this and concluded that it wouldn't be
possible to derive from an abstract C++ class in tinyclos anyway
(because of the impossibility of constructing an instance of that class
from anywhere but a subclass C++ constructor). So I decided to subclass
the problematic class from C++ providing default dummy implementations
for the abstract methods. Now I must call the (non-default) constructor
of the subclass and I'm having trouble with the easyffi parser for the
syntax: ctor(...) : base-ctor(..) {}. One thing I can do to solve this
is to put the definition inside a #> <# block and the declaration inside
a #>? <# block (instead of putting the definition once in-between #>!
<#). But in any case, the easyffi documentation in
http://galinha.ucpel.tche.br:8080//easyffi#foreign-include-path states
that the grammar supports calling base constructors:

CONSTRUCTOR = ["___callback" | "___safe"] ["explicit"] ID "(" ARGTYPE
"," ... ")" [BASECONSTRUCTORS] [CODE]

Specifically, the problematic line is:

  ScmStkFrames( unsigned int nFrames, unsigned int nChannels, bool
interleaved ) : StkFrames(nFrames, nChannels, interleaved) {}

And the reported error is:

Error: during expansion of (foreign-parse ...) - unexpected tokens: ((op
":") (id "StkFrames") open-paren (id "nFrames") comma (id "nChannels")
comma (id "interleaved") close-paren (scope))

Cheers!,
Carlos


On Sun, 2007-03-11 at 17:11 -0300, Carlos Pita wrote:
> Hi all,
> 
> suppose I have a C++ class FM with some pure/abstract/virtual=0 (you
> choose) methods that I want to expose to chicken via easyffi. This class
> has a constructor, to be used by its concrete subclasses (and I'm not
> the owner of the code, so avoiding ctors in abstract classes is a nono).
> The trouble is that even if I mark the class as ___abstract, easyffi is
> trying to instantiate it someway, so I get an error report from the g++
> compiler, something like:
> 
> /site/install/stk-4.2.1/include/FM.h:36: note:   because the following
> virtual functions are pure within ‘FM’:
> /site/install/stk-4.2.1/include/Instrmnt.h:27: note:    virtual void
> Instrmnt::noteOn(StkFloat, StkFloat)
> /site/install/stk-4.2.1/include/FM.h:88: note:  virtual StkFloat
> FM::computeSample()
> *** Shell command terminated with exit status 1: g++ fmscm.cpp -o
> fmscm.o -c -DHAVE_CHICKEN_CONFIG_H -Os -fomit-frame-pointer
> -fno-strict-aliasing -Wall -Wno-unused -Wno-uninitialized
> -DC_ENABLE_PTABLES -DC_NO_PIC_NO_DLL
> -I /data1/install/chicken-2.518/include/
> -I/site/install/stk-4.2.1/include
> 
> I could comment out the ctor and then things go fine, but I lose the
> chance to invoke this ctor from tinyclos concrete subclasses... don't I?
> 
> Can you help me?
> 
> Thank you in advance.
> Regards,
> Carlos
> 
> 
> 
>       
> 
>       
>               
> __________________________________________________ 
> Pregunt. Respond. Descubr. 
> Todo lo que queras saber, y lo que ni imaginabas, 
> est en Yahoo! Respuestas (Beta). 
> Probalo ya! 
> http://www.yahoo.com.ar/respuestas 
> 
> 
> 
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users


        

        
                
__________________________________________________ 
Pregunt�. Respond�. Descubr�. 
Todo lo que quer�as saber, y lo que ni imaginabas, 
est� en Yahoo! Respuestas (Beta). 
�Probalo ya! 
http://www.yahoo.com.ar/respuestas 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]