flibitijibibo/SDL2-CS — pull request #25 by jameson-ernst (2013-07-15 04:41:29+00:00)
Title: Marshaling refinements and SDL_ShowMessageBox

I was just implementing this myself when I saw you had done it also just recently. I felt it was still worth submitting though since it also includes the more general, difficult to marshal SDL_ShowMessageBox. From what I've tested it works fine, although from reading the SDL2 code, some of the parameters are ignored on windows, so it's hard to say for sure if it works on all platforms.

While implementing this, I also noticed an unfortunate property of p/invoke: array fields of structs are NOT marshaled as LPArrays, but rather as some kind of SAFE_ARRAY COM thing, which resulted in corrupt results until I marshaled it manually. This prompted me to go over all array marshalings in the library and make them more explicit. While doing that I also made more innocuous changes such as using "out" params where appropriate to improve self-documentation of the API.

Let me know if there's anything wrong in here and I can fix it up.