GSharp is a C# Shared project that makes it easy to interact with the C side of GMod.
- Clone this repo
- Create a new dll in visual studio
- Go to project properties>Build and set Platform target to x86, and tick Allow unsafe code
- Install the nuget package UnmanagedExports
- Add the GSharp shared project as a reference
- Make a class like the following:
public class Module
{
[DllExport("gmod13_open", CallingConvention = CallingConvention.Cdecl)]
public static int Open(lua_state L)
{
return 0;
}
[DllExport("gmod13_close", CallingConvention = CallingConvention.Cdecl)]
public static int Close(IntPtr L)
{
return 0;
}
}
- Start writing your code!