I am in need of creating an attribute whose value is shared among all the instances of the same class.
To this end, next to my class pointer, I declare a global variable to hold the attribute value:
t_class *s_myobj_class; // whatever...
In main I write the following code:
STATIC_ATTR_LONG(c, "attrname", ATTR_FLAGS_NONE, s_myattr_val);
This works to some extent, meaning that I do see the newly created attribute in the object's inspector and the attribute's value is indeed shared by all instances of the class. The problem is that the value is not assigned to my global variable (s_myattr_val), and I don't know where the value that Max references is. Needless to say, I cannot retrieve it to use it in my code.
I am using the STATIC_ATTR_LONG macro to create the attribute as it's suggested by the API, however (and here might very well be my mistake) the ext_obex_utils.h file says that the attribute value should be passed as "Pointer to the value".
I tried declaring my attribute as such:
STATIC_ATTR_LONG(c, "attrname", ATTR_FLAGS_NONE, &s_myattr_val);
but the behavior is the same.
I am compiling on Xcode 4.3, Max 6.0.4 SDK.
Thanks for any insight.