Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by [EMAIL PROTECTED]

http://bugzilla.ximian.com/show_bug.cgi?id=78379

--- shadow/78379        2006-05-15 04:37:17.000000000 -0400
+++ shadow/78379.tmp.11664      2006-05-15 07:01:39.000000000 -0400
@@ -81,6 +81,35 @@
 really a bug?
 isnt there a way to work around this ? purely on the mono side.
 if not, Tao.Sdl may be dead.
 how can someone use it, if u cant query the error message?
 
 i dont know much about pinvoke... if u can give me a hint
+
+------- Additional Comments From [EMAIL PROTECTED]  2006-05-15 07:01 -------
+SDL is perfectly fine, it is the C# wrapper method which needs to be
+changed. i.e, instead of 
+
+[DllImport(SDL_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION),
+SuppressUnmanagedCodeSecurity]
+               public static extern string SDL_GetError();
+
+there should be an internal method:
+
+[DllImport(SDL_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION,
+EntryPoint="SDL_GetError"),
+SuppressUnmanagedCodeSecurity]
+               public static extern IntPtr SDL_GetError_Internal();
+
+and the real SDL_GetError () method should look something like this:
+
+public static string SDL_GetError () {
+   return Marshal.PtrToStringAnsi (SDL_GetError_Internal ());
+}
+
+notice that the return type of SDL_GetError_Internal () is now
+'IntPtr', so the runtime doesn't try to free the value returned by the
+C function.
+
+The above solution works only if the native SDL_GetError () function
+allways returns static memory, if it returns dynamic memory, that will
+be leaked.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to