Function adresses in VST plugin

Have a bit unusual question ...

I would like to retrieve some additional function addreses from VST plugin. I host this plugin inside my JUCE plugin, so on Windows, i need native handle of loaded DLL library (DynamicLibrary object) ...

Is this possible without changing JUCE code ?



The DynamicLibary class exposes the native handle via the getNativeHandle method, which is a HANDLE to a DLL on windows. However, if you just want to get the address of a funciton you can use JUCE's getFunction method which is available on all platforms.

Thanks ... yes, i am aware of DynamicLibrary class and getFunction().

I would like to use existing handle, which is used inside VSTPluginInstance - as i said, in my plugin, i am hosting another plugin and after i load it, i would like to get some additional adresses from it. 

I would like to avoid platform dependent library loading/unloading just to get function adresses - everything is already done once the hosted plugin is loaded - i just need to access its native handle, but i am not sure if it's possible without changing some JUCE sources.


Ahh ok. I didn't read your initial post properly. I don't think there is a fully cross-platform way to do this currently, but almost: 

Try using getPlatformSpecificData of the AudioPluginInstance class. You should be able to dynamically cast your VST's AudioProcessor instance to AudioPlugInInstance.  You can then get the address of the processReplacing function and with this look-up the DLL's handle using the SymFromAddr (on windows) and the dladdr function (on linux/os x) to find the handle to the DLL.

Awesome - thank you :)