Search code examples
c#.netmonoaot

Is it Possible to use Mono AOT Compiled (Native)c# Executable and C# Dll(CIL) which has unimplemented Mono Methods


I have a main C# executable that can be compiled using Mono c# compiler, but the EXE uses DLLs which uses P/Invoke and other mono unsupported methods so I cannot compile this DLL to Mono. Is there any way use these DLLs with Ahead of Time Compiled Mono Executable?


Solution

  • Yes, it is possible to AOT-compile the main executable and still access non-AOT-compiled libraries.

    But AOT is not meant to be an obfuscation mechanism, in particular you still need the original main executable, otherwise your program won't run. The only reason you'd want to AOT-compile an executable/library, is to make it a little tiny bit faster in a few very specific scenarios.

    If you want to obfuscate, have a look at mkbundle.