Converting .NET App to x86 native code

前端 未结 5 2270
-上瘾入骨i
-上瘾入骨i 2020-12-05 05:10

There\'s a program written entirely in C# that targets .NET Framework 2.0. Is there a way I could somehow compile (translate) managed EXE to a native one so it could be .NET

5条回答
  •  被撕碎了的回忆
    2020-12-05 06:01

    Check out AOT (Ahead Of Time) Compilation from the Mono project. This compiles your managed project into a native exe or an elf executable (depending on which system you target) that does not need the JIT. This is the technique used to get mono apps onto the iPhone (where the JIT/Framework are not allowed) and also has the added benefits of faster startup times, lower memory usage and it makes it harder for people to decompile your code. You said you were already using Mono, so it should be compatible.

    Read up about it at the mono-project.com website and at Miguel de Icaza's blog (and iPhone info).

    Note that you cannot use dynamic code or generic interfaces like

    interface IFoo {
    ...
        void SomeMethod ();
    }
    

    And you will have to compile the DLLs of all the libraries you use.

    PS: Make sure to use "Full" AOT for your problem.

提交回复
热议问题