immortalvm / ivm-implementations

iVM contemporary implementations
5 stars 0 forks source link

Unable to load DLL 'libgdiplus' when using set_pixel on OS-X #2

Closed oleliabo closed 4 years ago

oleliabo commented 5 years ago
ole$ more draw_test.s

    stack_size = 16384
    allocate! stack_size
    add! stack_size
    set_sp

    new_frame* [32 32 0]

    set_pixel* [0 0 255 255 255]
    set_pixel* [1 1 255 255 255]
    set_pixel* [2 2 255 255 255]
    set_pixel* [3 3 255 255 255]
    set_pixel* [4 4 255 255 255]

    exit

ole$ ./ivm as-run draw_test.s
iVM Assembler and VM, version 0.9
Analyzing dependencies in draw_test.s...
Building draw_test.s...
Output ignored

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.
   at System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate()
   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at Machine.Executor.Machine.Step() in /Users/ivarru/Source/NR/ivm-implementations/Machine/Executor.fs:line 263
   at Machine.Executor.Machine.Run() in /Users/ivarru/Source/NR/ivm-implementations/Machine/Executor.fs:line 175
   at Machine.Executor.execute(IEnumerable`1 prog, IEnumerable`1 arg, FSharpOption`1 outputDir, FSharpOption`1 traceSyms) in /Users/ivarru/Source/NR/ivm-implementations/Machine/Executor.fs:line 287
   at Assembler.Checker.doRun(IEnumerable`1 binary, IEnumerable`1 arg, FSharpOption`1 outputDir, FSharpOption`1 traceSyms) in /Users/ivarru/Source/NR/ivm-implementations/Assembler/Checker.fs:line 136
   at Program.asRun(String source, FSharpOption`1 argFile, FSharpOption`1 outputDir, Boolean shouldTrace) in /Users/ivarru/Source/NR/ivm-implementations/Command/Program.fs:line 98
   at Program.main$cont@154-1(String[] argv, Int32 n, String matchValue, Unit unitVar) in /Users/ivarru/Source/NR/ivm-implementations/Command/Program.fs:line 163
   at Program.main(String[] argv) in /Users/ivarru/Source/NR/ivm-implementations/Command/Program.fs:line 156
Abort trap: 6
ivar-rummelhoff commented 5 years ago

This is due to a limitation in the current version of .NET Core. A workaround for OS X is explained in README.md. Hopefully, .NET Core 3.0 will provide a more satisfactory solution.

ivar-rummelhoff commented 5 years ago

This was hopefully fixed in f42b3b4e9b23dee7cf37d2b52e769b4e11a18065.