Can C/C++ software be compiled into bytecode for later execution? (Architecture independent unix software.)

前端 未结 6 972
失恋的感觉
失恋的感觉 2021-02-04 17:34

I would want to compile existing software into presentation that can later be run on different architectures (and OS).

For that I need a (byte)code that can be easily ru

6条回答
  •  春和景丽
    2021-02-04 18:02

    The real problem is that C and C++ are not architecture independent languages. You can write things that are reasonably portable in them, but the compiler also hardcodes aspects of the machine via your code. Think about, for example, sizeof(long). Also, as Richard mentions, there's no OS independence. So unless the libraries you use happen to have the same conventions and exist on multiple platforms then it you wouldn't be able to run the application.

    Your best bet would be to write your code in a more portable language, or provide binaries for the platforms you care about.

提交回复
热议问题