using System.Runtime.InteropServices; using System.Security; using System; public class TexTest { [DllImport("GL", EntryPoint="glGenTextures"), SuppressUnmanagedCodeSecurity, CLSCompliantAttribute(false)] public static extern void glGenTextures (int n, [Out] uint [] textures); public static void Main (string [] args) { uint [] ids = new uint [1]; Console.WriteLine ("testing"); glGenTextures (1, ids); Console.WriteLine ("done"); } } Stacktrace: at (wrapper managed-to-native) TexTest.glGenTextures (int,uint[]) <0x0000e> at (wrapper managed-to-native) TexTest.glGenTextures (int,uint[]) <0xffffffff> at TexTest.Main (string[]) <0x00048> at (wrapper runtime-invoke) System.Object.runtime_invoke_void_string[] (object,intptr,intptr,intptr) <0xffffffff> Native stacktrace: Unhandled Exception: System.NullReferenceException: A null value was found where an object instance was required. at <0x00000> at (wrapper managed-to-native) TexTest:glGenTextures (int,uint[]) at TexTest.Main (System.String[] args) [0x00000] ** ERROR **: file mini-exceptions.c: line 982 (mono_free_altstack): assertion failed: (err == 0) aborting... Aborted