Not by calling VirtualAlloc and friends, though. At least that part of the code has to be rewritten per platform.
I know that .NET is cross-platform, that was not my point. I'm referring to the parts where the article specifically mentions Windows API. How do I do the same on macOS and Linux? Is it even possible?
I don't see anything that doesn't have mac/Linux analogues but it would definitely require a concerted effort.