且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有字符串变量指令的 C/C++ 内联汇编器

更新时间:2022-04-07 16:08:02

你的程序的代码是由编译器在编译期间创建的.
您正试图在 运行时 为编译器提供输入 - 当程序已经在执行时.如果您想要即时编译",则必须编写一个增量编译器和链接器,以便在执行时修改代码.

The code of your program is created by the compiler, during compilation.
You are trying to feed the compiler the input for that at run time - when the program is already executing. If you want ‘on-the-fly-compilation’, you will have to program an incremental compiler and linker that can modify the code while executing it.

请注意,即使您会成功,许多操作系统也会阻止此类执行,因为它违反了安全性.这将是构建病毒的好方法,因此通常会被阻止.

Note that even if you would be successful, many OS would block such execution, as it violates security. It would be a great way to build viruses, and is therefore typically blocked.