Am Freitag, den 20.02.2009, 11:18 +0100 schrieb Xavier Glattard:

> > ** 3. How can I check at runtime if a function is implemented by the 
> > platform backend ?
> > For example "setValues" is not implemented on win32:
> >  [[self openGLContext] setValues:&swapInterval 
> > forParameter:NSOpenGLCPSwapInterval];
> 
> A call to a non-implemented method raises an exception. You may catch 
> it. As it's only implemented by Apple a compile time check should do the 
> job. But is this what you need ?

-resondsToSelector: is the canonical run time check.

id ctx = [self openGLContext];
if ([ctx respondsToSelector:@selector(setValues:forParameter:)])
  {
    [ctx setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
  }

Cheers,
David




_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to