-WEB_FILES= \
- ado-net c-sharp class-library contact contributing documentation download \
- faq gcc-frontend ideas index passport rationale resources \
- roadmap runtime status team testing thanks tools porting anoncvs monodoc-xml winforms
+WEB_FILES= \
+ ado-net anoncvs asp-net books ccvs c-sharp class-library contact contributing devel-faq documentation download \
+ embedded-api faq firebird gcc-frontend hackers ideas index \
+ java jit-debug languages mailing-lists monodoc-xml mysql odbc \
+ oledb papers \
+ passport plans porting postgresql ppc projects rationale \
+ resources roadmap runtime sqlclient sqlite sybase tdsclient \
+ tds-providers team status team testing thanks tools \
+ porting anoncvs monodoc-xml winforms
OTHERS= pending resources-pending todo mono-build.sh mono-build-w32.sh
the compiler and various programs are routinely compiled and
ran.
+** Slides
+
+ Slides for the Mono C# Compiler presentation at .NET ONE are
+ available <a
+ href=http://primates.ximian.com/~miguel/slides-europe-nov-2002/Mono_C_Sharp_Overview_1007.sxi">here</a>
+ in StarOffice format.
+
** Obtaining MCS
The Mono C# compiler is part of the `mcs' module in the Mono CVS
--- /dev/null
+* Embedding the Mono runtime, preliminary version
+
+ This document describes how to embed the Mono runtime in your
+ application, and how to invoke CIL methods from C, and how to
+ invoke C code from CIL
+
+ Slides for Paolo's presentation at .NET ONE on the embedding
+ API are available here: <a
+ href="http://primates.ximian.com/~lupus/slides/embed">Hosting the Mono
+ Runtime</a>. You can also get his <a
+ href="http://primates.ximian.com/~lupus/slides/embed/Mono-0.01.tar.gz">sample
+ Mono module for Perl</a>
+
+ Authors: Paolo Molaro, Miguel de Icaza.
+
+* Embedding the runtime.
+
+ Embedding the runtime consists of various steps:
+
+ <ul>
+ * Compiling and linking the Mono runtime
+
+ * Initializing the Mono runtime
+
+ * Optionally expose C code to the C#/CIL universe.
+
+ </ul>
+
+ These are discussed in detail next.
+
+** Compiling and Linking
+
+ To embed the runtime, you have to link your code against the
+ Mono runtime libraries. To do this, you want to pass the
+ flags returned by pkg-config to your compiler:
+
+ <pre>
+ pkg-config --cflags --libs mono
+ </pre>
+
+ Like this:
+
+ <pre>
+ gcc sample.c `pkg-config --cflags --libs mono`
+ </pre>
+
+ You can separate the compilation flags from the linking flags, for
+ instance, you can use the following macros in your makefile:
+
+ <pre>
+ CFLAGS=`pkg-config --cflags mono`
+ LDFLAGS=`pkg-config --libs mono`
+ </pre>
+
+** Initializing the Mono runtime
+
+ To initialize the runtime, call mono_jit_init, like this:
+
+ <pre>
+ MonoDomain *domain;
+
+ domain = mono_jit_init ("domain-name");
+ </pre>
+
+ That will return a MonoDomain where your code will be
+ executed. You can create multiple domains. Each domain is
+ isolated from the other domains and code in one domain will
+ not interfere with code in other domains. This is useful if
+ you want to host different applications in your program.
+
+ Then you can load an assembly containing code into the domain:
+
+ <pre>
+ MonoAssembly *assembly;
+
+ assembly = mono_domain_assembly_open (domain, "file.dll");
+ if (!assembly)
+ error ();
+ </pre>
+
+ In the above example, the contents of `file.dll' will be
+ loaded into the domain. This only loads the code, but it will
+ not execute anything yet. You can replace `file.dll' with
+ another transport file, like `file.exe'
+
+ To start executing code, you must invoke a method in the
+ assembly, or if you have provided a static Main method (an
+ entry point), you can use the convenience function:
+
+ <pre>
+ retval = mono_jit_exec (domain, assembly, argc - 1, argv + 1);
+ </pre>
+
+ If you want to invoke a different method, look at the
+ `Invoking Methods in the CIL universe' section later on.
+
+** Shutting down the runtime
+
+ To shutdown the Mono runtime, you have to clean up all the
+ domains that were created, use this function:
+
+ <pre>
+ mono_jit_cleanup (domain);
+ </pre>
+
+** Applications that use threads.
+
+ The Boehm GC system needs to catch your calls to the pthreads
+ layer, so in each file where you use pthread.h you should
+ include the <gc/gc.h> file.
+
+* Exposing C code to the CIL universe
+
+ The Mono runtime provides two mechanisms to expose C code to
+ the CIL universe: internal calls and native C code. Internal
+ calls are tightly integrated with the runtime, and have the
+ least overhead, as they use the same data types that the
+ runtime uses.
+
+ The other option is to use the Platform Invoke (P/Invoke) to
+ call C code from the CIL universe, using the standard P/Invoke
+ mechanisms.
+
+ To register an internal call, use this call in the C code:
+
+ <pre>
+ mono_add_internal_call ("Hello::Sample", sample);
+ </pre>
+
+ Now, you need to declare this on the C# side:
+
+ <pre>
+ using System;
+ using System.Runtime.CompilerServices;
+ </pre>
+
+
+ <pre>
+ class Hello {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static string Sample ();
+ }
+ </pre>
+
+ Since this routine returns a string, here is the C definition:
+
+ <pre>
+ static MonoString*
+ Sample ()
+ {
+ return mono_string_new (mono_domain_get (), "Hello!");
+ }
+ </pre>
+
+ Notice that we have to return a `MonoString', and we use the
+ `mono_string_new' API call to obtain this from a string.
+
+* Invoking Methods in the CIL universe
+
+ Calling a method in the CIL universe from C requires a number of steps:
+
+ <ul>
+ * Obtaining the MonoMethod handle to the method.
+
+ * The method invocation.
+ </ul>
+
+** Obtaining a MonoMethod
+
+ To get a MonoMethod there are several ways.
+
+ You can get a MonoClass (the structure representing a type)
+ using:
+
+ <pre>
+ MonoClass *
+ mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
+ </pre>
+
+ and then loop in the returned class method array until you get
+ the one you're looking for. There are examples of such
+ searches as static functions in several C files in
+ metadata/*.c: we need to expose one through the API and remove
+ the duplicates.
+
+ The other, simpler, way is to use the functions in
+ debug-helpers.h: there are examples of their use in monograph,
+ mint and the jit as well. You basically use a string
+ description of the method, like:
+
+ <pre>
+ "System.Object:GetHashCode()"
+ </pre>
+
+ and create a MonoMethodDesc out of it with:
+
+ <pre>
+ MonoMethodDesc* mono_method_desc_new (const char *name, gboolean include_namespace);
+ </pre>
+
+ You can then use:
+
+ <pre>
+ MonoMethod* mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass);
+ MonoMethod* mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image);
+ </pre>
+
+ to search for the method in a class or in an image. You would
+ tipically do this just once at the start of the program and
+ store the result for reuse somewhere.
+
+** Invoking a Method
+
+ There are two functions to call a managed method:
+
+ <pre>
+ MonoObject*
+ mono_runtime_invoke (MonoMethod *method, void *obj, void **params,
+ MonoObject **exc);
+ and
+ MonoObject*
+ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
+ MonoObject **exc);
+ </pre>
+
+ obj is the 'this' pointer, it should be NULL for static
+ methods, a MonoObject* for object instances and a pointer to
+ the value type for value types.
+
+ The params array contains the arguments to the method with the
+ same convention: MonoObject* pointers for object instances and
+ pointers to the value type otherwise. The _invoke_array
+ variant takes a C# object[] as the params argument (MonoArray
+ *params): in this case the value types are boxed inside the
+ respective reference representation.
+
+ From unmanaged code you'll usually use the
+ mono_runtime_invoke() variant.
+
+ Note that this function doesn't handle virtual methods for
+ you, it will exec the exact method you pass: we still need to
+ expose a function to lookup the derived class implementation
+ of a virtual method (there are examples of this in the code,
+ though).
+
+ You can pass NULL as the exc argument if you don't want to
+ catch exceptions, otherwise, *exc will be set to the exception
+ thrown, if any. if an exception is thrown, you can't use the
+ MonoObject* result from the function.
+
+ If the method returns a value type, it is boxed in an object
+ reference.
+
+ We have plans for providing an additional method that returns
+ an unmanaged->managed thunk like this:
+
+ <pre>
+ void* mono_method_get_unmanaged_thunk (MonoMethod *method);
+ </pre>
+
+ You'll be able to store the returned pointer in a function
+ pointer with the proper signature and call that directly from
+ C:
+
+ <pre>
+ typedef gint32 (*GetHashCode) (MonoObject *obj);
+
+ GetHashCode func = mono_method_get_unmanaged_thunk (System_Object_GetHashCode_method);
+
+ gint32 hashvalue = func (myobject);
+ </pre>
+
+ It may not be possible to manage exceptions in that case,
+ though. I need to think more about it.
+
+* Samples
+
+ See the sample programs in mono/sample/embed for examples of
+ embedding the Mono runtime in your application.
+
+
Mono includes: <a href="c-sharp.html">a compiler</a> for the
C# language, a <a href="runtime.html">runtime</a> for the
Common Language Infrastructure (also referred as the CLR) and a
- set of <a href="class-library.html">class libraries</a>.
+ set of <a href="class-library.html">class libraries</a>. The
+ runtime can be <a href="embedded-api.html">embedded</a> into your
+ application.
Mono has implementations of both <a href="ado-net">ADO.NET</a>
and <a href="asp-net">ASP.NET</a> as part of its distribution.
</ul>
Currently we are using the Bohem conservative garbage
- collector, but we working on incorporating the ORP GC engine.
+ collector.
-** Executing MSIL/CIL images
+ The Mono runtime can be used as a stand-alone process, or it
+ can be <a href="embedded-api">embedded into applications</a> (see
+ the documentation in mono/samples/embed for more details).
- The code will load an executable and map the references to
- external assemblies to our own version of the assemblies on
- Linux.
+ Embedding the Mono runtime allows applications to be extended
+ in C# while reusing all of the existing C and C++ code.
- Our roadmap looks like this, this has been updated as of
- <b>Dec 18, 2001</b>:
+ Paolo Molaro did a presentation on the current JIT engine and
+ the new JIT engine. You can find his <a
+ href="http://primates.ximian.com/~lupus/slides/jit/">slides
+ here</a>
- <ul>
-
- * Milestone 1: <b>Done</b> Fully read and parse all CIL byte-codes
- and metadata tokens (ie, a disassembler).
-
- * Milestone 2: <b>Done</b> Complete an interpreter for CIL byte
- codes. This interpreter can be used temporarly to
- run CIL byte code on a system where no JIT is
- available.
-
- * Milestone 3: <b>Done</b>Define an <i>lburg</i>-like
- instruction selector for the JITer for Intel.
-
- * Milestone 4: <b>Done</b> Implement JITer. This is where our
- current efforts are focused on, the JITer currently runs
- all of the code we have tested on it. The major limitation
- is that our class libraries are not complete, and hence not
- every application can be ran.
-
- * Milestone 5: Port of the JITer to non IA32 systems.
- </ul>
-
- A setup similar to the Kaffe JIT engine will be used to
- layout the code to support non-IA32 architectures. Our work
- will be focused on getting a IA32 version running first.
-
- The JIT engine works on Linux and Win32, although you
- will need to install the CygWin32 development tools to get a
- Unix-like compilation environment (mostly we use GNU make in
- a few of the makefiles).
-
-** JIT Engine (<b>updated, July 8th, 2002</b>)
+** Current JIT Engine (<b>updated, July 8th, 2002</b>)
The JIT engine uses a code-generator generator approach for
compilation. Given the properties of CIL byte codes, we can
</ul>
-** Future plans
-
- We are evaluating the future directions for the JIT engine:
- both from our needs (optimizations like inlining, better register allocation,
- instruction scheduling, and porting to other CPUs).
+** New JIT engine.
- We have not yet decided how we will evolve the JIT engine. We
- might just upgrade our current architecture, and provide optimizations as
- an extra layer.
+ We are working on a new JIT engine. The new JIT engine
+ focuses on portability and in two intermediate representations
+ that simplify the development of optimizations. This together
+ with the Ahead-of-Time compilation will allow developers to
+ deploy applications that match the speed of natively compiled code.
** Garbage Collection
1,FAQ,faq.html,faq.src
0,Mono,rationale.html,rationale.src
1,Runtime,runtime.html,runtime.src
+2,Embedding,embedded-api.html,embedded-api.src
1,Classes,class-library.html,class-library.src
1,Gtk#,http://gtk-sharp.sourceforge.net
1,ASP.NET,asp-net.html,asp-net.src
CORCOMPARE=../../../mcs/tools/corcompare
-OBJECTS= \
- deploy/ado-net.html \
- deploy/firebird.html \
- deploy/mysql.html \
- deploy/odbc.html \
- deploy/oledb.html \
- deploy/postgresql.html \
- deploy/sqlclient.html \
- deploy/sqlite.html \
- deploy/sybase.html \
- deploy/tdsclient.html \
- deploy/anoncvs.html \
- deploy/asp-net.html \
- deploy/books.html \
- deploy/contributing.html \
- deploy/class-status.html \
- deploy/class-status-corlib.html \
- deploy/class-status-System.html \
- deploy/class-status-System.Xml.html \
- deploy/class-status-System.Drawing.html \
- deploy/class-status-System.Data.html \
- deploy/class-status-System.Web.html \
- deploy/class-status-System.Web.Services.html \
- deploy/class-status-Microsoft.VisualBasic.html \
- deploy/class-status-System.EnterpriseServices.html \
+OBJECTS= \
+ deploy/ado-net.html \
+ deploy/firebird.html \
+ deploy/mysql.html \
+ deploy/odbc.html \
+ deploy/oledb.html \
+ deploy/postgresql.html \
+ deploy/sqlclient.html \
+ deploy/sqlite.html \
+ deploy/sybase.html \
+ deploy/tdsclient.html \
+ deploy/anoncvs.html \
+ deploy/asp-net.html \
+ deploy/books.html \
+ deploy/contributing.html \
+ deploy/class-status.html \
+ deploy/class-status-corlib.html \
+ deploy/class-status-System.html \
+ deploy/class-status-System.Xml.html \
+ deploy/class-status-System.Drawing.html \
+ deploy/class-status-System.Data.html \
+ deploy/class-status-System.Web.html \
+ deploy/class-status-System.Web.Services.html \
+ deploy/class-status-Microsoft.VisualBasic.html \
+ deploy/class-status-System.EnterpriseServices.html \
deploy/class-status-System.Runtime.Serialization.Formatters.Soap.html \
- deploy/class-status-System.Windows.Forms.html \
- deploy/class-library.html \
- deploy/classlib-doc.html \
- deploy/contact.html \
- deploy/c-sharp.html \
- deploy/ccvs.html \
- deploy/documentation.html \
- deploy/download.html \
- deploy/faq.html \
- deploy/gcc-frontend.html \
- deploy/hackers.html \
- deploy/index.html \
- deploy/ideas.html \
- deploy/java.html \
- deploy/jit-debug.html \
- deploy/jit-debug-sample.html \
- deploy/jit-debug-sample2.html \
- deploy/languages.html \
- deploy/mailing-lists.html \
- deploy/mono-beginning.html \
- deploy/mono-contribution-howto.html \
- deploy/monodoc-xml.html \
- deploy/papers.html \
- deploy/passport.html \
- deploy/plans.html \
- deploy/porting.html \
- deploy/ppc.html \
- deploy/rationale.html \
- deploy/resources.html \
- deploy/roadmap.html \
- deploy/runtime.html \
- deploy/status.html \
- deploy/testing.html \
- deploy/tools.html \
+ deploy/class-status-System.Windows.Forms.html \
+ deploy/class-library.html \
+ deploy/classlib-doc.html \
+ deploy/contact.html \
+ deploy/c-sharp.html \
+ deploy/ccvs.html \
+ deploy/documentation.html \
+ deploy/download.html \
+ deploy/embedded-api.html \
+ deploy/faq.html \
+ deploy/gcc-frontend.html \
+ deploy/hackers.html \
+ deploy/index.html \
+ deploy/ideas.html \
+ deploy/java.html \
+ deploy/jit-debug.html \
+ deploy/jit-debug-sample.html \
+ deploy/jit-debug-sample2.html \
+ deploy/languages.html \
+ deploy/mailing-lists.html \
+ deploy/mono-beginning.html \
+ deploy/mono-contribution-howto.html \
+ deploy/monodoc-xml.html \
+ deploy/papers.html \
+ deploy/passport.html \
+ deploy/plans.html \
+ deploy/porting.html \
+ deploy/ppc.html \
+ deploy/rationale.html \
+ deploy/resources.html \
+ deploy/roadmap.html \
+ deploy/runtime.html \
+ deploy/status.html \
+ deploy/testing.html \
+ deploy/tools.html \
deploy/winforms.html
#2,Configuration.Install,class-status-System.Configuration.Install.html,class-status-System.Configuration.Install.src,cm/cormissing.css,cm/cormissing.js
#2,Runtime.Remoting,class-status-System.Runtime.Remoting.html,class-status-System.Runtime.Remoting.src,cm/cormissing.css,cm/cormissing.js
-WEB_FILES= \
- ado-net c-sharp class-library contact contributing documentation download \
- faq gcc-frontend ideas index passport rationale resources \
- roadmap runtime status team testing thanks tools porting anoncvs monodoc-xml winforms
+WEB_FILES= \
+ ado-net anoncvs asp-net books ccvs c-sharp class-library contact contributing devel-faq documentation download \
+ embedded-api faq firebird gcc-frontend hackers ideas index \
+ java jit-debug languages mailing-lists monodoc-xml mysql odbc \
+ oledb papers \
+ passport plans porting postgresql ppc projects rationale \
+ resources roadmap runtime sqlclient sqlite sybase tdsclient \
+ tds-providers team status team testing thanks tools \
+ porting anoncvs monodoc-xml winforms
OTHERS= pending resources-pending todo mono-build.sh mono-build-w32.sh
the compiler and various programs are routinely compiled and
ran.
+** Slides
+
+ Slides for the Mono C# Compiler presentation at .NET ONE are
+ available <a
+ href=http://primates.ximian.com/~miguel/slides-europe-nov-2002/Mono_C_Sharp_Overview_1007.sxi">here</a>
+ in StarOffice format.
+
** Obtaining MCS
The Mono C# compiler is part of the `mcs' module in the Mono CVS
--- /dev/null
+* Embedding the Mono runtime, preliminary version
+
+ This document describes how to embed the Mono runtime in your
+ application, and how to invoke CIL methods from C, and how to
+ invoke C code from CIL
+
+ Slides for Paolo's presentation at .NET ONE on the embedding
+ API are available here: <a
+ href="http://primates.ximian.com/~lupus/slides/embed">Hosting the Mono
+ Runtime</a>. You can also get his <a
+ href="http://primates.ximian.com/~lupus/slides/embed/Mono-0.01.tar.gz">sample
+ Mono module for Perl</a>
+
+ Authors: Paolo Molaro, Miguel de Icaza.
+
+* Embedding the runtime.
+
+ Embedding the runtime consists of various steps:
+
+ <ul>
+ * Compiling and linking the Mono runtime
+
+ * Initializing the Mono runtime
+
+ * Optionally expose C code to the C#/CIL universe.
+
+ </ul>
+
+ These are discussed in detail next.
+
+** Compiling and Linking
+
+ To embed the runtime, you have to link your code against the
+ Mono runtime libraries. To do this, you want to pass the
+ flags returned by pkg-config to your compiler:
+
+ <pre>
+ pkg-config --cflags --libs mono
+ </pre>
+
+ Like this:
+
+ <pre>
+ gcc sample.c `pkg-config --cflags --libs mono`
+ </pre>
+
+ You can separate the compilation flags from the linking flags, for
+ instance, you can use the following macros in your makefile:
+
+ <pre>
+ CFLAGS=`pkg-config --cflags mono`
+ LDFLAGS=`pkg-config --libs mono`
+ </pre>
+
+** Initializing the Mono runtime
+
+ To initialize the runtime, call mono_jit_init, like this:
+
+ <pre>
+ MonoDomain *domain;
+
+ domain = mono_jit_init ("domain-name");
+ </pre>
+
+ That will return a MonoDomain where your code will be
+ executed. You can create multiple domains. Each domain is
+ isolated from the other domains and code in one domain will
+ not interfere with code in other domains. This is useful if
+ you want to host different applications in your program.
+
+ Then you can load an assembly containing code into the domain:
+
+ <pre>
+ MonoAssembly *assembly;
+
+ assembly = mono_domain_assembly_open (domain, "file.dll");
+ if (!assembly)
+ error ();
+ </pre>
+
+ In the above example, the contents of `file.dll' will be
+ loaded into the domain. This only loads the code, but it will
+ not execute anything yet. You can replace `file.dll' with
+ another transport file, like `file.exe'
+
+ To start executing code, you must invoke a method in the
+ assembly, or if you have provided a static Main method (an
+ entry point), you can use the convenience function:
+
+ <pre>
+ retval = mono_jit_exec (domain, assembly, argc - 1, argv + 1);
+ </pre>
+
+ If you want to invoke a different method, look at the
+ `Invoking Methods in the CIL universe' section later on.
+
+** Shutting down the runtime
+
+ To shutdown the Mono runtime, you have to clean up all the
+ domains that were created, use this function:
+
+ <pre>
+ mono_jit_cleanup (domain);
+ </pre>
+
+** Applications that use threads.
+
+ The Boehm GC system needs to catch your calls to the pthreads
+ layer, so in each file where you use pthread.h you should
+ include the <gc/gc.h> file.
+
+* Exposing C code to the CIL universe
+
+ The Mono runtime provides two mechanisms to expose C code to
+ the CIL universe: internal calls and native C code. Internal
+ calls are tightly integrated with the runtime, and have the
+ least overhead, as they use the same data types that the
+ runtime uses.
+
+ The other option is to use the Platform Invoke (P/Invoke) to
+ call C code from the CIL universe, using the standard P/Invoke
+ mechanisms.
+
+ To register an internal call, use this call in the C code:
+
+ <pre>
+ mono_add_internal_call ("Hello::Sample", sample);
+ </pre>
+
+ Now, you need to declare this on the C# side:
+
+ <pre>
+ using System;
+ using System.Runtime.CompilerServices;
+ </pre>
+
+
+ <pre>
+ class Hello {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static string Sample ();
+ }
+ </pre>
+
+ Since this routine returns a string, here is the C definition:
+
+ <pre>
+ static MonoString*
+ Sample ()
+ {
+ return mono_string_new (mono_domain_get (), "Hello!");
+ }
+ </pre>
+
+ Notice that we have to return a `MonoString', and we use the
+ `mono_string_new' API call to obtain this from a string.
+
+* Invoking Methods in the CIL universe
+
+ Calling a method in the CIL universe from C requires a number of steps:
+
+ <ul>
+ * Obtaining the MonoMethod handle to the method.
+
+ * The method invocation.
+ </ul>
+
+** Obtaining a MonoMethod
+
+ To get a MonoMethod there are several ways.
+
+ You can get a MonoClass (the structure representing a type)
+ using:
+
+ <pre>
+ MonoClass *
+ mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
+ </pre>
+
+ and then loop in the returned class method array until you get
+ the one you're looking for. There are examples of such
+ searches as static functions in several C files in
+ metadata/*.c: we need to expose one through the API and remove
+ the duplicates.
+
+ The other, simpler, way is to use the functions in
+ debug-helpers.h: there are examples of their use in monograph,
+ mint and the jit as well. You basically use a string
+ description of the method, like:
+
+ <pre>
+ "System.Object:GetHashCode()"
+ </pre>
+
+ and create a MonoMethodDesc out of it with:
+
+ <pre>
+ MonoMethodDesc* mono_method_desc_new (const char *name, gboolean include_namespace);
+ </pre>
+
+ You can then use:
+
+ <pre>
+ MonoMethod* mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass);
+ MonoMethod* mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image);
+ </pre>
+
+ to search for the method in a class or in an image. You would
+ tipically do this just once at the start of the program and
+ store the result for reuse somewhere.
+
+** Invoking a Method
+
+ There are two functions to call a managed method:
+
+ <pre>
+ MonoObject*
+ mono_runtime_invoke (MonoMethod *method, void *obj, void **params,
+ MonoObject **exc);
+ and
+ MonoObject*
+ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
+ MonoObject **exc);
+ </pre>
+
+ obj is the 'this' pointer, it should be NULL for static
+ methods, a MonoObject* for object instances and a pointer to
+ the value type for value types.
+
+ The params array contains the arguments to the method with the
+ same convention: MonoObject* pointers for object instances and
+ pointers to the value type otherwise. The _invoke_array
+ variant takes a C# object[] as the params argument (MonoArray
+ *params): in this case the value types are boxed inside the
+ respective reference representation.
+
+ From unmanaged code you'll usually use the
+ mono_runtime_invoke() variant.
+
+ Note that this function doesn't handle virtual methods for
+ you, it will exec the exact method you pass: we still need to
+ expose a function to lookup the derived class implementation
+ of a virtual method (there are examples of this in the code,
+ though).
+
+ You can pass NULL as the exc argument if you don't want to
+ catch exceptions, otherwise, *exc will be set to the exception
+ thrown, if any. if an exception is thrown, you can't use the
+ MonoObject* result from the function.
+
+ If the method returns a value type, it is boxed in an object
+ reference.
+
+ We have plans for providing an additional method that returns
+ an unmanaged->managed thunk like this:
+
+ <pre>
+ void* mono_method_get_unmanaged_thunk (MonoMethod *method);
+ </pre>
+
+ You'll be able to store the returned pointer in a function
+ pointer with the proper signature and call that directly from
+ C:
+
+ <pre>
+ typedef gint32 (*GetHashCode) (MonoObject *obj);
+
+ GetHashCode func = mono_method_get_unmanaged_thunk (System_Object_GetHashCode_method);
+
+ gint32 hashvalue = func (myobject);
+ </pre>
+
+ It may not be possible to manage exceptions in that case,
+ though. I need to think more about it.
+
+* Samples
+
+ See the sample programs in mono/sample/embed for examples of
+ embedding the Mono runtime in your application.
+
+
Mono includes: <a href="c-sharp.html">a compiler</a> for the
C# language, a <a href="runtime.html">runtime</a> for the
Common Language Infrastructure (also referred as the CLR) and a
- set of <a href="class-library.html">class libraries</a>.
+ set of <a href="class-library.html">class libraries</a>. The
+ runtime can be <a href="embedded-api.html">embedded</a> into your
+ application.
Mono has implementations of both <a href="ado-net">ADO.NET</a>
and <a href="asp-net">ASP.NET</a> as part of its distribution.
</ul>
Currently we are using the Bohem conservative garbage
- collector, but we working on incorporating the ORP GC engine.
+ collector.
-** Executing MSIL/CIL images
+ The Mono runtime can be used as a stand-alone process, or it
+ can be <a href="embedded-api">embedded into applications</a> (see
+ the documentation in mono/samples/embed for more details).
- The code will load an executable and map the references to
- external assemblies to our own version of the assemblies on
- Linux.
+ Embedding the Mono runtime allows applications to be extended
+ in C# while reusing all of the existing C and C++ code.
- Our roadmap looks like this, this has been updated as of
- <b>Dec 18, 2001</b>:
+ Paolo Molaro did a presentation on the current JIT engine and
+ the new JIT engine. You can find his <a
+ href="http://primates.ximian.com/~lupus/slides/jit/">slides
+ here</a>
- <ul>
-
- * Milestone 1: <b>Done</b> Fully read and parse all CIL byte-codes
- and metadata tokens (ie, a disassembler).
-
- * Milestone 2: <b>Done</b> Complete an interpreter for CIL byte
- codes. This interpreter can be used temporarly to
- run CIL byte code on a system where no JIT is
- available.
-
- * Milestone 3: <b>Done</b>Define an <i>lburg</i>-like
- instruction selector for the JITer for Intel.
-
- * Milestone 4: <b>Done</b> Implement JITer. This is where our
- current efforts are focused on, the JITer currently runs
- all of the code we have tested on it. The major limitation
- is that our class libraries are not complete, and hence not
- every application can be ran.
-
- * Milestone 5: Port of the JITer to non IA32 systems.
- </ul>
-
- A setup similar to the Kaffe JIT engine will be used to
- layout the code to support non-IA32 architectures. Our work
- will be focused on getting a IA32 version running first.
-
- The JIT engine works on Linux and Win32, although you
- will need to install the CygWin32 development tools to get a
- Unix-like compilation environment (mostly we use GNU make in
- a few of the makefiles).
-
-** JIT Engine (<b>updated, July 8th, 2002</b>)
+** Current JIT Engine (<b>updated, July 8th, 2002</b>)
The JIT engine uses a code-generator generator approach for
compilation. Given the properties of CIL byte codes, we can
</ul>
-** Future plans
-
- We are evaluating the future directions for the JIT engine:
- both from our needs (optimizations like inlining, better register allocation,
- instruction scheduling, and porting to other CPUs).
+** New JIT engine.
- We have not yet decided how we will evolve the JIT engine. We
- might just upgrade our current architecture, and provide optimizations as
- an extra layer.
+ We are working on a new JIT engine. The new JIT engine
+ focuses on portability and in two intermediate representations
+ that simplify the development of optimizations. This together
+ with the Ahead-of-Time compilation will allow developers to
+ deploy applications that match the speed of natively compiled code.
** Garbage Collection
1,FAQ,faq.html,faq.src
0,Mono,rationale.html,rationale.src
1,Runtime,runtime.html,runtime.src
+2,Embedding,embedded-api.html,embedded-api.src
1,Classes,class-library.html,class-library.src
1,Gtk#,http://gtk-sharp.sourceforge.net
1,ASP.NET,asp-net.html,asp-net.src
CORCOMPARE=../../../mcs/tools/corcompare
-OBJECTS= \
- deploy/ado-net.html \
- deploy/firebird.html \
- deploy/mysql.html \
- deploy/odbc.html \
- deploy/oledb.html \
- deploy/postgresql.html \
- deploy/sqlclient.html \
- deploy/sqlite.html \
- deploy/sybase.html \
- deploy/tdsclient.html \
- deploy/anoncvs.html \
- deploy/asp-net.html \
- deploy/books.html \
- deploy/contributing.html \
- deploy/class-status.html \
- deploy/class-status-corlib.html \
- deploy/class-status-System.html \
- deploy/class-status-System.Xml.html \
- deploy/class-status-System.Drawing.html \
- deploy/class-status-System.Data.html \
- deploy/class-status-System.Web.html \
- deploy/class-status-System.Web.Services.html \
- deploy/class-status-Microsoft.VisualBasic.html \
- deploy/class-status-System.EnterpriseServices.html \
+OBJECTS= \
+ deploy/ado-net.html \
+ deploy/firebird.html \
+ deploy/mysql.html \
+ deploy/odbc.html \
+ deploy/oledb.html \
+ deploy/postgresql.html \
+ deploy/sqlclient.html \
+ deploy/sqlite.html \
+ deploy/sybase.html \
+ deploy/tdsclient.html \
+ deploy/anoncvs.html \
+ deploy/asp-net.html \
+ deploy/books.html \
+ deploy/contributing.html \
+ deploy/class-status.html \
+ deploy/class-status-corlib.html \
+ deploy/class-status-System.html \
+ deploy/class-status-System.Xml.html \
+ deploy/class-status-System.Drawing.html \
+ deploy/class-status-System.Data.html \
+ deploy/class-status-System.Web.html \
+ deploy/class-status-System.Web.Services.html \
+ deploy/class-status-Microsoft.VisualBasic.html \
+ deploy/class-status-System.EnterpriseServices.html \
deploy/class-status-System.Runtime.Serialization.Formatters.Soap.html \
- deploy/class-status-System.Windows.Forms.html \
- deploy/class-library.html \
- deploy/classlib-doc.html \
- deploy/contact.html \
- deploy/c-sharp.html \
- deploy/ccvs.html \
- deploy/documentation.html \
- deploy/download.html \
- deploy/faq.html \
- deploy/gcc-frontend.html \
- deploy/hackers.html \
- deploy/index.html \
- deploy/ideas.html \
- deploy/java.html \
- deploy/jit-debug.html \
- deploy/jit-debug-sample.html \
- deploy/jit-debug-sample2.html \
- deploy/languages.html \
- deploy/mailing-lists.html \
- deploy/mono-beginning.html \
- deploy/mono-contribution-howto.html \
- deploy/monodoc-xml.html \
- deploy/papers.html \
- deploy/passport.html \
- deploy/plans.html \
- deploy/porting.html \
- deploy/ppc.html \
- deploy/rationale.html \
- deploy/resources.html \
- deploy/roadmap.html \
- deploy/runtime.html \
- deploy/status.html \
- deploy/testing.html \
- deploy/tools.html \
+ deploy/class-status-System.Windows.Forms.html \
+ deploy/class-library.html \
+ deploy/classlib-doc.html \
+ deploy/contact.html \
+ deploy/c-sharp.html \
+ deploy/ccvs.html \
+ deploy/documentation.html \
+ deploy/download.html \
+ deploy/embedded-api.html \
+ deploy/faq.html \
+ deploy/gcc-frontend.html \
+ deploy/hackers.html \
+ deploy/index.html \
+ deploy/ideas.html \
+ deploy/java.html \
+ deploy/jit-debug.html \
+ deploy/jit-debug-sample.html \
+ deploy/jit-debug-sample2.html \
+ deploy/languages.html \
+ deploy/mailing-lists.html \
+ deploy/mono-beginning.html \
+ deploy/mono-contribution-howto.html \
+ deploy/monodoc-xml.html \
+ deploy/papers.html \
+ deploy/passport.html \
+ deploy/plans.html \
+ deploy/porting.html \
+ deploy/ppc.html \
+ deploy/rationale.html \
+ deploy/resources.html \
+ deploy/roadmap.html \
+ deploy/runtime.html \
+ deploy/status.html \
+ deploy/testing.html \
+ deploy/tools.html \
deploy/winforms.html
#2,Configuration.Install,class-status-System.Configuration.Install.html,class-status-System.Configuration.Install.src,cm/cormissing.css,cm/cormissing.js
#2,Runtime.Remoting,class-status-System.Runtime.Remoting.html,class-status-System.Runtime.Remoting.src,cm/cormissing.css,cm/cormissing.js