[Mono-list] Detecting if platform is Mac
cdhowie at gmail.com
Mon Jan 5 14:00:48 EST 2009
On Mon, Jan 5, 2009 at 1:51 PM, Erik Ylvisaker
<eylvisaker at physics.ucdavis.edu> wrote:
> So, the reason I want to detect if we are running MacOS is I am writing
> Mac OpenGL bindings for the OpenTK project. On MacOS we need to make
> appropriate AGL calls instead of GLX or WGL calls in order to construct
> an OpenGL context. Perhaps a better solution would be to check the type
> of the XPlatUI driver to see what it is, although I'd like to avoid
> writing code which depends on private mono internals.
My favorite method of dealing with platform-specific native libraries
is to find a function in the libraries that doesn't do anything, or
that you can feed invalid input to cause it to do nothing (but
obviously not crash). Specify a P/Invoke definition for each, then
call them until you find one that doesn't throw DllNotFoundException.
Then that's your library/platform.
More information about the Mono-list