[PD] [flext] Inheriting access to variables declared once in a library

Thomas Grill gr at grrrr.org
Mon Jul 31 10:23:25 CEST 2006


Hi Christian,
although it would be beneficial to have some example code, i would 
guess you need the following:
Set a static counter to 0 in the beginning, when an object is created, 
check if the counter is 0 and create your "static" instances - 
increment the counter in any case.
In object destructors, decrement the counter. If it has reached 0, 
destroy your "static" instances.

greetings,
Thomas

Am 31.07.2006 um 01:50 schrieb Christian Frisson:

> Hi,
>
> I'm currently using flext to develop a library of externals itself 
> wrapping
> another C++ library. On the latter library, some setup classes have to 
> be
> instanciated once only in a whole application. What's the way to 
> benefit from
> inheritance in order to:
> - declare instances of those setup classes only in the base flext 
> class of the
> library in order to create each only once;
> - share access with externals, being flext inherited classes of the 
> base class?
>
> As I'm a poor C++ coder, the only ugly way I've yet found to 
> circumvent this is
> declaring instances of those setup classes outside flext classes, 
> statically.
> But for sure those variable won't get deleted and Pd sends a "read 
> memory"
> error message when it's being closed...
>
> Any idea?
>
> Thanks,
> Christian
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list
>
>





More information about the Pd-list mailing list