shin1m / IL2CXX

Yet another .NET IL to C++ transpiler with concurrent GC
23 stars 2 forks source link

System.Exception: 'System.Reflection.RuntimeAssembly in System.Runtime.InteropServices.NativeLibrary :: System.Boolean TryLoad... #2

Open MaxEden opened 1 month ago

MaxEden commented 1 month ago

Hi, I'm trying my best to transpile AutoPong example

my console args:

"--target", "Win32NT", "--out", "buildWin", "C:\Git_Hub\IL2CXX\examples\Platformer2D\MonoGame.Samples\AutoPong\AutoPong.DesktopGL\bin\Debug\net8.0\AutoPong.DesktopGL.dll"

I'm getting

System.Exception: 'System.Reflection.RuntimeAssembly in System.Runtime.InteropServices.NativeLibrary :: System.Boolean TryLoad(System.String, System.Reflection.Assembly, System.Nullable`1[System.Runtime.InteropServices.DllImportSearchPath], System.IntPtr&)'

at

IL2CXX.dll!IL2CXX.Transpiler.ThrowIfInvalid(System.Type type) Line 559 C# IL2CXX.dll!IL2CXX.Transpiler.Enqueue(System.Type type) Line 563 C# IL2CXX.dll!IL2CXX.Transpiler.Escape(System.Type type) Line 597 C# IL2CXX.dll!IL2CXX.Transpiler.GenerateIsAssignableTo(string x, System.Type t) Line 978 C# IL2CXX.dll!IL2CXX.Transpiler..ctor.AnonymousMethod218(int index, IL2CXX.Transpiler.Stack stack) Line 936 C# IL2CXX.dll!IL2CXX.Transpiler.ProcessNextMethod(System.Func<System.Type, bool, System.IO.TextWriter> writerForType) Line 249 C# IL2CXX.dll!IL2CXX.Transpiler.Do(System.Reflection.MethodInfo method, System.IO.TextWriter writerForDeclarations, System.IO.TextWriter writerForDefinitions, System.Func<System.Type, bool, System.IO.TextWriter> writerForType) Line 293 C# IL2CXX.Console.dll!Program.

$.AnonymousMethod0_0(Options options) Line 190 C# CommandLine.dll!CommandLine.ParserResultExtensions.MapResult<Options, int>(CommandLine.ParserResult result, System.Func<Options, int> parsedFunc, System.Func<System.Collections.Generic.IEnumerable, int> notParsedFunc) Unknown IL2CXX.Console.dll!Program.
$(string[] args) Line 15 C#

Do I miss something?

shin1m commented 1 week ago

@MaxEden Thank you for trying IL2CXX.

It was far from working on Windows, and took a while.

I fixed several issues and merged into the main branch. I also added AutoPong to the examples.

Please check it out.

MaxEden commented 1 week ago

Thank you for your fixes, I finally managed to build the project (cmake on windows is a nightmare) now when I try to launch the built exe I get this error caught: no entry point: AutoPong.DesktopGL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

shin1m commented 1 week ago

@MaxEden MonoGame uses Reflection which IL2CXX cannot detect. --reflection would be necessary to tell IL2CXX which reflection data to include. Please refer to the following: https://github.com/shin1m/IL2CXX/blob/c5862daebfb3bc4ed39140d1765827c9baa4bd1d/examples/AutoPong/build.bat#L7