bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 questions about Application Services, 1 about backend


From: Xavier Glattard
Subject: Re: 2 questions about Application Services, 1 about backend
Date: Fri, 20 Feb 2009 11:44:49 +0100
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

David Ayers a écrit :
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

Yes but [setValues:forParameter] is implemented as:
   '[self notImplemented]'

So '[respondsToSelector:@selector(setValues:forParameter:)]' will always
return YES, and [setValues:forParameter] always raises an exception.

Regards
- Xavier




reply via email to

[Prev in Thread] Current Thread [Next in Thread]