+1  A: 

MyStruct mystruct is private in MyClass, I assume when you do myClass.myStruct you are only refering to generated accessor method not the actual structure.

I don't think you can access the instance variable (structure in this case) from outside because it is private.

stefanB
I too am assuming that myClass.myStruct is getting the value returned by the accessor method - not the actual structure which is what I want.Assuming, I make the instance variable private... how can I get a pointer to the actual structure and not the accessor method?
You can try to return the address from a member method (see Chuck's answer) or you could add method to MyClass class that will call the C api and pass the address of the mystruct structure.
stefanB
A: 

To get a pointer to the myStruct instance variable, you need to write a method that returns a pointer to that instance variable.

- (void)getMyStructPointer:(MyStruct **)outStruct {
    *outstruct = &myStruct;
}

I don't really think this is a good idea, though. Other objects should not be mutating that object's ivar out from under it, and that's the only thing you can do with a pointer to the struct that you can't do with a copy of the struct returned by value.

Chuck
Unless the struct is very large; memory usage could potentially be an issue.
BJ Homer
A: 

The question itself demostrates a lack of understanding of at least the terminology.

A property is an interface consisting of two (or one for readonly) methods made public by the object, namely the getter and setter methods, in this case:

- (MyStruct) myStruct;
- (void) setMyStruct: (MyStruct) newMyStruct;

It makes no sense to talk about "taking the address of a property".

You can take the address of an instance variable (ivar). In this case you have an ivar named mystruct, and you can take the address of it with &mystruct in a method of MyClass. Since it is marked @protected (by default), you can take the address of it in a subclass using &self->mystruct. If you mark it @public, then you could take the address of it using &myobj->mystruct. This is a terrible idea, and you should really really rethink this, but you could do it.

If you just want the address of the ivar for some short lived purpose (for example, if MyStruct was large) you could do this, but it would be very unusual, and you'd be better off writing an explicitly named method like:

- (MyStruct*) getAddressForSettingMyStruct;

and if it is just read only, even better would be to use const MyStruct*.

Peter N Lewis
This answer comes off kind of snobbish. Be Nice.
Brenden