[PD] question about external free functions

Mathieu Bouchard matju at artengine.ca
Sat Dec 5 04:26:28 CET 2009


On Tue, 1 Dec 2009, Rich E wrote:

> Okay, so Ctrl-Q skips all free functions on purpose.  If I am 
> understanding correctly, I need to register my cleanup function with 
> atexit on a function of type void _function_(void), but that means I 
> don't have access to any of my object's member variables.

one workaround is to make a global map<MyClass,int> where int is a dummy 
(unfortunately, void is not accepted as an argument of that type-pattern).

> In the case of flext, the external class would need to be declared as 
> static in order for its destructor to be called before shutting down - 
> do you know if this is right, or possible, Thomas or anyone else knowing 
> about flext/C++ and pd?

This doesn't sound right. Note that there are some things that apply to 
objects that are directly global, and don't apply when the global 
variables are just pointers. I almost always use the latter because the 
former is a pain in the ass. (any static variable counts as global in this 
case, because they're essentially a kind of hidden global).

> The reason I need this is because I am messing around with disconnecting 
> the wacom events from controlling the tablet, which takes some calls 
> that change the driver's settings.  If I cannot turn the settings back 
> before the program stops, they are permanently screwed until I restart 
> the driver/computer.  At least, this is all I can tell so far.

ow. so what can it do in case of segmentation fault or other crash of 
Pd?... what happens if you bang a naked [until] while you use your wacom 
thing?

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801


More information about the Pd-list mailing list