Hi folks,
My first post here - new to the whole Mac/iPhone/ObjC world.
I am trying to access a C++ multidimensional array from Objective C. The array is large and autogenerated from a previous project and it is not really convenient to change it into an NSArray.
The nub of the problem is this: the compiler complains at the following code:-
The message is: "error: instance variable '_map' has unknown size."
Now I can see where it's coming from with that, but this particular line compiles quite happily in both ANSI C and - more pertinently - in a C++ class header file, because at the end of the day _map is a pointer, which is of very specific size
Incidentally, if I change the declaration to this:-
Then it compiles and works fine, but I feel that is a bit of a nasty hack and leaves me not fully understanding why Objective C doesn't handle normal C/C++ array syntax, and that I'll probably run into more trouble further down the line.
Any thoughts on this would be appreciated!
My first post here - new to the whole Mac/iPhone/ObjC world.
I am trying to access a C++ multidimensional array from Objective C. The array is large and autogenerated from a previous project and it is not really convenient to change it into an NSArray.
The nub of the problem is this: the compiler complains at the following code:-
Code:
@interface Texture2D : NSObject
...
int _map[][4];
...
@end
The message is: "error: instance variable '_map' has unknown size."
Now I can see where it's coming from with that, but this particular line compiles quite happily in both ANSI C and - more pertinently - in a C++ class header file, because at the end of the day _map is a pointer, which is of very specific size
Incidentally, if I change the declaration to this:-
Code:
@interface Texture2D : NSObject
...
int (*_map)[4];
...
@end
Then it compiles and works fine, but I feel that is a bit of a nasty hack and leaves me not fully understanding why Objective C doesn't handle normal C/C++ array syntax, and that I'll probably run into more trouble further down the line.
Any thoughts on this would be appreciated!