Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 827 Bytes

readme.md

File metadata and controls

30 lines (25 loc) · 827 Bytes

GSharp

GSharp is a C# Shared project that makes it easy to interact with the C side of GMod.

Creating a new module

  1. Clone this repo
  2. Create a new dll in visual studio
  3. Go to project properties>Build and set Platform target to x86, and tick Allow unsafe code
  4. Install the nuget package UnmanagedExports
  5. Add the GSharp shared project as a reference
  6. 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;
  }
}
  1. Start writing your code!