Error: undefined identifier 'selector'

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 14 17:31:52 PST 2015


On Monday, 14 December 2015 at 23:34:28 UTC, tcak wrote:
> On Monday, 14 December 2015 at 20:46:41 UTC, Mike McKee wrote:
>> When I run this piece of code:
>>
>> // FROM: https://dlang.org/spec/objc_interface.html
>> module main;
>>
>> [...]
>
> UDA s cannot be used for functions/methods AFAIK.

It doesn't give an example in the documentation, but UDAs 
certainly can be used for functions and methods.

http://dpaste.dzfl.pl/14722d9a289b

In fact, `selector` is a compiler-recognized UDA specifically 
used for Objective-C compatibility. As for OP's issue, from the 
page he linked:

The attribute [selector] is only defined when the version 
identifier D_ObjectiveC is enabled.

Also, just in case:

It [D's Objective-C support] is only available on OS X, compiling 
for 64bit.


More information about the Digitalmars-d-learn mailing list