Re: List Object's methods using class_nextMethodList Problem
Re: List Object's methods using class_nextMethodList Problem
- Subject: Re: List Object's methods using class_nextMethodList Problem
- From: Michael Babin <email@hidden>
- Date: Wed, 17 Oct 2007 14:01:20 -0500
On Oct 17, 2007, at 1:19 PM, colela wrote:
I am having trouble using the suggested technique for accessing a
class' method list using class_nextMethodList.
In xCode 2.5, the following code fragment:
//method enumeration example
- (CC *)enumMethodList;
{
void *iterator = 0;
struct objc_method_list *mList;
Class theClass = [self class];
int k;
NSString *className = [theClass description];
mList = class_nextMethodList( theClass, &iterator );
while( mList != NULL )
{
/*
for(k=0; k < mList->method_count; k++)
{
NSLog(@"%@ implements %s", className, mList->method_list
[k].method_name);
}
*/
mList = class_nextMethodList( theClass, &iterator );
}
}
runs and shows the method list (mList) in the debugger and its
contents are accessible there.
When I remove the comments around the for loop, the compiler
generates 2 "dereferencing pointer to incomplete type" error
messages; 1 for the method_count reference and 1 for the
method_name reference.
The compiler settings are default except I have "Handle Objective-C
Exceptions" enabled.
You are, of course, including/importing the header file that defines
objc_method_list, correct?
#import <objc/objc-class.h>
- Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden