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: Mon, 12 Mar 2007 09:00:10 -0300

> This works for me:
> 
> #>?
> class ScmStkFrames {
>  ScmStkFrames( unsigned int nFrames, unsigned int nChannels, bool
> interleaved ) : StkFrames(nFrames, nChannels, interleaved) {}
> };
> <#
> 

fmscm.scm
----------

(use tinyclos)

#>?

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

<#

Then compile with:

csc -c -c++ -X easyffi fmscm.scm

The diff between your code snippet and mine that makes the difference is
the "public:" visibility modifier being there or not.

Cheers,
Carlos

On Mon, 2007-03-12 at 09:48 +0100, felix winkelmann wrote:
> On 3/12/07, Carlos Pita <address@hidden> wrote:
> > 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))
> >


> 
> Can you provide a complete example?
> 
> 
> cheers,
> felix


        

        
                
__________________________________________________ 
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]