Accessing static variables from JUCE modules


#1

For example, i would like to access variable activeVSTWindows (declared as static in juce_VSTPluginFormat.cpp) from my plugin processor or editor (don't ask me why :)

On my side, I've declared it as external variable. Now, I am getting unresolved symbol at link time.

Also, for experimental purposes, i  would like to define global variable in my processor and then using it in  VSTPluginInstance class for example.

The same problem applies.

I guess there is something i don't understand (maybe namespaces) ... any ideas ?

Sorry for a rookie question, but i've done this with plugin client modules without a problem.

Thx!


#2

Don't do it!

Internal variables are internal for a reason. They're undocumented, their behaviour may subtly change in the future and silently break your code, or they may just disappear without warning. They're hidden for your own protection!

And in general, and especially in plugins, it's a rookie mistake to use global variables at all. There's always a better way!


#3

I usually don't :)

But as i said for experimental quick solutions, i sometimes do - anyway, i still don't understand why my global variable is not visible in JUCE source module despite being declared there as external  ?!?

I am trying to understand JUCE more deeply,  so i am experimenting in a different ways and getting into all kind of troubles :)

Thx!


#4

I could explain how to access that symbol, but for your own good I'm not going to!

Beware quick+dirty test hacks.. They too often become production code and technical debt!


#5

wink