SteveSandersonMS / dotnet-wasi-sdk

Packages for building .NET projects as standalone WASI-compliant modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Load platform native library

Beyley opened this issue · comments

Is it possible to use DLLImport to call into native libraries? ex.

[DllImport("glfw")]
static extern int glfwInit();

...

glfwInit();

Upon attempting to do it this way causes an error

Unhandled Exception:
System.InvalidProgramException
   at Program.<Main>$(String[] args)

trying to use

var lib = NativeLibrary.Load("libglfw.so");

just causes

Unhandled Exception:
System.DllNotFoundException: 'libglfw.so': ''
   at System.Runtime.InteropServices.NativeLibrary.Load(String libraryPath)
   at Program.<Main>$(String[] args)