I’m not sure I understand entirely what you’re asking. Member variables are defined in your class definitions. In Objective-C, it would look like this:
@interface SomeClass { someType someMemberVariable; } @end
or in C++ like this:
class SomeClass { public: // or protected or private someType someMemberVariable; }
Now every time you create an object of type “SomeClass” it will allocate space for “someMemberVariable.” Each object of SomeClass will have its own copy of “someMemberVariable”.
It’s not clear what you mean by “the variable is in a library.” If it’s a global, that’s usually not a great way to write a library, but might be acceptable if it’s a singleton or something like that. In that case, there’s only one copy and you can’t change that unless you wrote the library and have the source to it. If so, you could instead make a method to allocate and return a new one rather than always returning the singleton.
If you mean it’s inside a function within the library, then it’s either allocated statically (so essentially a global that’s only accessible within that function), it’s allocated on the stack every time the function is called, or it’s allocated on the heap by the function and its lifetime will depend on what the library and caller do with it.
Darrin On Jan 17, 2014, at 3:24 PM, Ardo Avancena < email@hidden> wrote: Is it still possible to make the variable a member variable even if the variable is in a library?
I haven't pin pointed which variable is the one that's causing it but I am fairly certain that having two instances of the plugin on a given time crashes it. And it only happens on osx10.9 since it works on 10.8.
|