On Sun, Jun 14, 2015 at 3:36 PM, Alexandre Clément <alexandre.r.clement@gmail.com> wrote:I tried going the same approach as checking if a receiver exists before attempting to send, but it doesn't seem to work.Is there a way to check this upon creation?Hello all!I'm creating an external which should only allow one copy loaded at the same time.
if (gensym("class_name")->s_thing) {
post("Exists!");
return false;
}Because gensym generates the symbol if it wasn't already in the list.What I do is have a global variable outside the class struct and check if it is not zero before instantiating a new object.Since c is guaranteed to initialize globals to zero, the first object created can set it to some other value. Maybe some more trickery will be needed if the object is deleted and recreated, possibly the code is still in memory and the global will have the non-zero value; in this case the free routine should zero the global,Martin