0

I need to get access to an object inside a C function similar to this few code

@interface MixerHostAudio ()  <UIApplicationDelegate>
@property (readwrite) int *alternativeOutput;
@end

@implementation MyCode
@synthesize alternative

void audioInputAvailable () {
   alternative=1;
}

I get this error: " 'Use of undeclared identifier 'alternative' "

Any ideas about how can i solve it ?

2
  • If you want to @synthesize a @property as something other than its exact name, you have to use the format: @synthesize propertyName = synthesizedName;. But chances are pretty good that you should be accessing them via self. anyway. Commented Jan 24, 2014 at 0:56
  • Remember that every instance variable has a meaning only if it's associated with an object. Instead inside a function, since it's not a method, you can't access to self, you aren't "inside an object". Commented Jan 24, 2014 at 1:41

1 Answer 1

4

You have to make your "MyCode" object available somewhere for your C glue function to pick up. For example, if you have a pointer to your MyCode object...

void audioInputAvailable(MyCode *myCodeObject){
   myCodeObject.alternative = 1;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.