VST3 Plugin from Mac to Windows: Memory acess violation

Hi there!
I made a plugin that does the job on MacOSX environment.
I would like now to compile it on Windows.
I thought it was, not quick, but feasible, and I realize now that the journey is long and complicated.

More precisely, I am stuck on a memory access error.
I tried to debug with Visual Studio 2019 that load the Audio Plugin Host.
I can’t figure out why this doesn’t work.

In the PluginProcessor.cpp, I use the processBlock(...) function inside a loop to compute each sample of a buffer (I get that from the audio plugin 2 tutorial).

In this loop I’ve got something like:

next_sample_value = my_midi_handler -> my_Synth -> compute_next_sample()

The code break in the compute_next_sample() function.

When I try to debug it with Visual Studio, the weird thing is that I’ve got good parameters values for my_Synth inside the processBlock function, but when I step into the compute_next_sample() function, the parameter values have changed.
And so it rise an exception for memory access violation (it tries to access values in a array, but the index value (that changed…) is now out of the range of the array).

Any idea how I can debug that?
It is really frustrating, as this code was working on MacOSX… thanks a lot for your answer!

Is VS writing the plugin in the correct VST3 location, or do you copy the plugin from the build location to the VST3 folder? If you have a copy step (manual or automatic), perhaps you’re forgetting to copy or the copy is failing? Having code that doesn’t match what you’re running can cause this kind of odd behavior.

Also, check the addresses of the “parameters” you’re described. Are the addresses the same when seen from processBlock() as they are from inside compute_next_sample()?

There is also the possibility that the values actually are changing, due to multiple threads running. A debugger changes the thread priorities, so it can be difficult to tell when this happens. For those cases, I generally add some short DBG statements that report values to me if they detect anything odd, or at regular intervals like the start of a buffer.

One other possibility is that you have overwritten a buffer and written data over top of the my_Synth data members accidentally.

That’s all I can think of at the moment. Good luck on your hunt!