且构网

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

如何在32位或64位环境中以编程方式启动程序?

更新时间:2022-01-12 02:50:37

除了@GWW编写的内容之外,如果您真的想以编程方式执行此操作,则可以使用 posix_spawn 一个>.

In addition to what @GWW wrote, if you really want to do this programmatically, you can use posix_spawnattr_setbinpref_np to set the preferred CPU type and then use posix_spawn.

CPU类型由cpu_type_t指定,我相信它是在#include <mach/machine.h>中定义的.但是包含#include <mach-o/arch.h>可能更安全.请参见 arch(3)联机帮助页.

The CPU type is specified by cpu_type_t, which I believe is defined in #include <mach/machine.h>. But it may be safer to include #include <mach-o/arch.h>. See arch (3) manpage.