[Mono-dev] Iterating the classes of a mono image using the embedding API

Argiris Kirtzidis akyrtzi at gmail.com
Tue Dec 5 12:21:41 EST 2006

Ok, after some digging into the Mono internals, I found a way. I post it in 
case someone else finds it useful too:

static void
print_all_types (MonoImage *image)
 MonoClass *klass;
 int i;

 int rows = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF);

 /* we start the count from 1 because we skip the special type <Module> */
 for (i = 1; i < rows; ++i) {
        klass = mono_class_get (image, (i + 1) | MONO_TOKEN_TYPE_DEF);
        printf ("Class name: %s.%s\n", mono_class_get_namespace (klass), 
mono_class_get_name (klass));


 On 12/5/06, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
> Hi all,
> Is there a way to get all the classes/types defined in a image using the
> embedding API ? I looked through all the functions and I can't find one 
> that
> will allow iteration of all the classes, am I missing something ?
> How one would get a list of the classes that a mono image contains using
> only plain C ?
> Argiris
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list> progress depends 
> on the unreasonable man." George Bernard Shaw 

More information about the Mono-devel-list mailing list