SharpVk-Samples
SharpVk-Samples copied to clipboard
Linux
I've tested SharpVK on linux, to have it working (debian 10):
- change 'glfw3' to 'glfw' for library name, under debian, lib has the version suffixes out of the scope of dll import.
- use 'Path.Combine' to build shader pathes (directory backslash is for win only).
After these two simple steps, HelloTriangle works.
So this falls into one of the gaps in .NET Core's handling of P/Invoke. In early versions (targetting Mono & .NET Fx) the difference in library names was handled by DllMap entries in the executable config; that is no longer possible in Core, so I'm not 100% sure how to fix it.
- I could switch the library name to "glfw" and rename all the DLLs in the examples, but that seems hacky and likely to break existing Windows code.
- I could remove direct P/Invoke and use some kind of NativeLibrary shim to load per-platform, but that would be a decent chunk of work and a breaking change to the API.
- There is DllMap support coming in .NET Core, possibly as soon as 3.0, but that's an uncertain wait.
The best option would be a dll map like mechanic. On linux, it's possible to create a symbolic link to target glfw3 name. That's maybe the best alternative for now.