Value changed in DLL


#1

Hi there,

I begin in using JUCE, and have a deal that I cannot manage alone.
Here the facts :

  • I have a DLL with some core computations
  • I have a main app with my own main() that calls previous DLL
  • I want to have in the main a progress of the computations done in DLL

Actually, I try to get the progress thanks to object juce::Value in DLL, using a Value::Listener in my main app. But no progress is returned to my main app, and when the app exits, a memory leak shows up.

In the DllMain part, I have initializeJuce_GUI() and shutdownJuce_GUI() in respectively DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH parts.

What am I missing here ?


#2

I tried something else: settings a listener into the same class, in the DLL, writing strings to cout.
That does not work neither…
I must really miss something


#3

Ok so, I searched for a while but I found my solution:

  • Code my own main()
  • Use initialiseJuce_GUI() in it
  • Launching my computations in a thread apart, which ends with MessageManager::getInstance()->stopDispatchLoop()
  • Call MessageManager::getInstance()->startDispatchLoop()
  • Call shutdownJuce_GUI() at last, after thread finished

I don’t know if it is a regular use of JUCE, but it works and for now on, it is only what I need.