How to initialize JUCE to work as a DLL(with no GUI)

Firstly, I am not making a plugin, rather, I’m using JUCE for it’s DSP and hardware device abstractions. The intended use of the dll is to handle audio and dsp for a WinUI app.
I have a juce dynamic library project I’m using, but as of now, I’m not starting a new JUCE application and this seems to have some problems like the one below. It throws randomly(or I’m didn’t notice any pattern).

There are a few other errors that arrise and I think most of them are because of this. The app works 90% of times, but I don’t have access to the Message Thread, and I need to notify the WinUI app when my transport source stopped playing. Can’t do that because I can’t instatiate a MessageManager.

I didn’t find any meaninful topics regarding my problem, also the documenation is quite lacking in this scenario. There are examples for creating an app with CMAKE, but problems arise when you want to use DeviceManager s or things that would likely require a full on JUCE App.

If you have any guidance on this matter, I am all ears. Code snippets/ repos are highly appreciated and I can also provide snippets of how my code looks if needed.

I believe you need to call initialiseJuce_GUI to set up the MessageManager, when you’re not using JUCE inside a JUCEApplication. It can be easily done with the ScopedJuceInitialiser_GUI. Check it out here: JUCE: ScopedJuceInitialiser_GUI Class Reference

Doesn’t work, it throws “Access violation writing location” when trying to initialize the MessageManager.