[Mono-devel-list] Creating types at runtime

Jonathan Pryor jonpryor at vt.edu
Tue Mar 9 20:47:41 EST 2004


On Tue, 2004-03-09 at 08:31, August Steinbacher wrote:
> Hello all,
> I am starting to work on a mechanism that allows managed programs to use
> unmanaged objects and vice versa.

Sounds like Platform Invoke, depending on how you define "unmanaged
objects."  Unmanaged C++ objects?  Or "object" meaning "memory"? 
Something else?

> My first task is to create a type object at runtime from a given tye
> description in the form of XSD.

Simple enough -- you want to write a compiler that translates the XSD
into a set of types.  Look into System.Reflection.Emit.  Looking at the
source to "mcs" might be helpful as well.

> So my question is if anybody has concerned with this topic and maybe could
> give me a slight kickoff and head me in the right direction (since I'm a
> bloody mono-newbie...) ?

My "slight kickoff" is above, though you haven't provided much
information about what *exactly* you're trying to do.

One thing to keep in mind is that Mono is a statically-typed
environment.  Which means that you can't have existing, pre-compiled
code directly reference a set of classes you'll be generating at
run-time, as the classes won't exist yet. :-)

A workaround would be to define a set of interfaces/base classes that
your generated code will implement/derive from, and that existing code
can compile against.  Regardless, your design will need to take this
into consideration.

 - Jon

More information about the Mono-devel-list mailing list