I’m using PackageCompiler.jl to build a shared library, which I then link into a C driver program. One of my @ccallable functions takes a “large” (168 bytes) struct as an argument by value. Things worked fine on macOS, but then my CI on Linux was failing. I found that a later argument, which was a pointer, was not pointing at the same address in both Julia and C. It took me a little while to figure this out, but that large struct that was passed by value was also getting different bytes. This seems to be some kind of inconsistency in the calling convention, so Julia was basically reading the wrong bytes for the arguments, but I’m in over my head here.
I gather that one way to fix this is to just avoid passing large structs by value, and instead pass pointers. But I thought I’d ask about it here to try to learn a bit more.
Is this a bug, or is this unavoidable?