You are writing native code, it is dependend on the target, and since windows and macos are far away from beeing compatible this can never work.
But this doesnt matter, the source code does matter, and this of course can be shared. Just dont share the binaries, especially not the intermediate object files.