Rack compiler question

Hi folks,

this is a tough one. I was wondering if it is possible to compile VCV rack using a different compiler than mingw’s g++? The reason why I am asking is the following:

The module I am trying to build is a module that moves data via Windows’ shared memory. I was using boost to manage all of the shared memory layout, lockfree queue, etc. However, the other software that I am trying to communicate with is compiled with Msvc. Even though, I was able to get shared memory to work on both ends by themselves, but they are unable to interact due to different data structure layouts.

So, I am in search of a way to create compatible data structure layouts in memory between VCV rack and the other system.

I guess the first question is if this is possible on Windows? If so, how?

The second question is, what about on MacOS? I believe Xcode has gone over to LLVM and Clang, and I assume VCV Rack is still being compiled with gcc?

Thank you.

You can’t compile Rack with MSVC - it uses some non-standard gcc extensions, including variable length arrays. You’d also need to compile every other piece of the Rack process the same way - all the dependencies, and all the plugins. It would be a huge undertaking.

But if you’re really only talking about data structures, meaning a struct containing fundamental data types, you should be OK. At most you might need to use pragmas to control the layout, eg. padding and alignment.

Can you tell what the difference is between the two sides? If you create your structure on each side, populate it with some text data and hex dump it, where are the differences?

In the Mac environment, “gcc” is just a wrapper for clang, so you should be OK.

1 Like

hmm. I haven’t tried the hex dump yet and compare the differences. I will have to look into that. If you have any link or documentations on how to do that, that would be great. If not, I will just google :smile:

The structs aren’t that simple. They are boost managed shared memory segment manager objects. But I can definitely make a few simple ones to debug out the problem.

Good to know about Mac.

Thank you!

(I’m assuming you have two processes here, which is why you’re using shared memory - correct me if I’m wrong!)

I would use Visual Studio to debug the processes, and the look at the memory block in the debugger’s Memory window. Obviously that’s easy for your MSVC process, and it can be done for your Rack process as well - see Debug in VSCode with Rack-SDK?

1 Like

Awesome. Thanks.

not usually if you’re using c++ - g++ and msvc’s mangling are different enough that they aren’t compatible. you might be able to build a c only library to attempt to mitigate that, but it would likely be very fragile.

Yah, I think that might be the first alternative for me to try. It’s also the recommend solution from MinGW.

Thanks.