Sokol_csharp
NuGet: https://www.nuget.org/packages/sokol_csharp.unofficial/
C# bindings for Sokol generated from https://github.com/MichalStrehovsky/sokol/tree/gen_csharp.
They follow the same model as the "official" bindings for Zig and Nim in the official Sokol repo at https://github.com/floooh/sokol.
The C# generator is not upstreamed to Sokol yet which is why I point to my private fork. I want to get some mileage on it before I try to contribute it.
To build a shared library with Sokol binaries that the C# source p/invokes into, cd into src/sokol/c and build the sokol.c file.
I'm building this without annoying CRT dependencies (#define NO_CRT
), but you don't have to. This is my build workflow:
On Windows, to build a shared library you can run:
$ cl /DNO_CRT /EHs-c- /GR- /LD /Zi /Zl /GS- /O1 /Gs8192 sokol.c /link path_to_your\msvcrt.lib /noentry /opt:ref,icf
You can grab a msvcrt.lib from e.g. https://github.com/neosmart/msvcrt.lib.
On Windows, to build a static library suitable to be used with bflat, run:
cl /DNO_CRT /DBFLAT_LIB /c /EHs-c- /GR- /Zi /Zl /GS- /O1 /Gs8192 sokol.c
lib sokol.obj