[flext] Basic question about ADDMETHOD

Thomas Grill gr at grrrr.org
Thu Jan 14 14:11:09 UTC 2016


Hi Martin,
the difference is that ADDMETHOD is used for per-instance methods (they are typically set in the constructur, as you did), whereas CADDMETHOD is for per-class static functions (those are set in a class setup function).
Actually, the use of per-instance methods is not encouraged and will not be supported any longer in future flext versions.
best, Thomas

> Am 14.01.2016 um 06:02 schrieb Martin Jaroszewicz <temporum at gmail.com>:
> 
> Dear forum,
> 
> I'm new to Flext, and haven't coded in C++ in a long time. I'm trying to make the code below compile but get the following error:
> 
> error: reference to non-static member function must be called
> FLEXT_ADDMETHOD_S(0,"read",m_read);
> 
> Also can someone clarify the difference between the two ways to register methods (ADDMETHOD and CADDMETHOD) ? Does this have to do with passing pointers as arguments (?). Code below
> I'm trying to read a text file into a vector. This is the first step.
> 
> '''
> #include <flext.h>
> 
> #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
> #error You need at least flext version 0.4.0
> #endif
> 
> class hello:
> 
> 	public flext_base
> {
> 
> 	FLEXT_HEADER(hello,flext_base)
> 
> public:
> 
>     hello();
> 
> protected:
> 
>     void m_read(t_symbol *argument);
> 
> private:
> 
>     FLEXT_CALLBACK_S(m_read)
> };
> 
> FLEXT_NEW("hello",hello)
> 
> 
> hello::hello() {
> 
> 
>     AddInAnything();
> 
>     FLEXT_ADDMETHOD_S(0,"read",m_read);
> 
> }
> 
> void hello::m_read(t_symbol *argument) {
>     post("reading argument: %s)",GetString(argument));
> 
> }
> '''
> _______________________________________________
> http://grrrr.org/ext/flext
> 
> flext mailing list
> flext at grrrr.org
> http://grrrr.org/cgi-bin/mailman/listinfo/flext

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://grrrr.org/pipermail/flext/attachments/20160114/a69d1c87/attachment.sig>


More information about the flext mailing list