Alternatively, instead of creating a compile-able file (in whatever language), transform it into a program in a scripting language, say Python or Perl, which can then be executed by the the scripting ...
Microsoft has released Sysmon 15, converting it into a protected process and adding the new ‘FileExecutableDetected’ option to log when executable files are created. For those not familiar with Sysmon ...