[Mono-list] Embedding Mono Question

Paolo Molaro lupus at ximian.com
Wed Sep 14 14:49:21 EDT 2005


On 09/12/05 Eoin Coffey wrote:
> Right now I'm working on embedding the Mono runtime into an application. The 
> Mono C API is, for the most part, very clean and well layed out.
> 
> The only thing that is lacking is decent docs of that API.

Did you have a look at the sample code in mono/samples/embed/?

> What I want to know is if there is a way to query an image or assembly about 
> what classes it contains. I know the assemblies carry the information, I 
> just haven't found a way for Mono to tell me about it yet :-D

There is no specific API, because it's easy enough, maybe I should
add a single function to iterate on the types, but it saved only one
line of code if even that...

static void
dump_types (MonoImage *image)
{
        MonoClass *klass;
        int i, total;

        total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF);
        for (i = 1; i <= total; ++i) {
                klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i);
                g_print ("got class: %s.%s\n", mono_class_get_namespace (klass), mono_class_get_name (klass));
        }
}

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better


More information about the Mono-list mailing list