Skip to content

Instantly share code, notes, and snippets.

@KevinJones
Created February 14, 2014 15:28

Revisions

  1. KevinJones created this gist Feb 14, 2014.
    15 changes: 15 additions & 0 deletions MyCFunction.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    // a global function; no need to expose this in a header file

    void internalDoSomething()
    {
    // put your function here.
    }

    // note that if you were using C++ or Objective-C++ you'd need to put this in an extern closure, like so:
    extern "C"
    {
    void internalDoSomething()
    {
    // ...
    }
    }
    10 changes: 10 additions & 0 deletions MyCFunction.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    // In a Unity C# class:

    public class MyCFunction {
    public static void DoSoemthing() {
    internalDoSomething();
    }

    [DllImport ("__Internal")]
    private static extern void internalDoSomething();
    }