Merge pull request #3622 from rolfbjarne/remove-stray-file
[mono.git] / docs / embedded-api
index 1fd739ae2ba82eda4fbb23486982cd6fabf74f7d..f44f4ed15cad9abbf2274dc5d336b5e1e7f51e5d 100644 (file)
@@ -3,12 +3,21 @@
                 Miguel de Icaza (miguel@ximian.com),
                   Paolo Molaro (lupus@ximian.com)
 
                 Miguel de Icaza (miguel@ximian.com),
                   Paolo Molaro (lupus@ximian.com)
 
+
        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. Both the JIT and interpreter can be
        embedded in very similar ways so most of what is described
        here can be used in either case.
 
        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. Both the JIT and interpreter can be
        embedded in very similar ways so most of what is described
        here can be used in either case.
 
+* IMPORTANT
+
+       This document is now outdated, see:
+
+               http://www.mono-project.com/Embedding_Mono
+
+        For an up-to-date version of this document
+
 * Embedding the runtime.
 
        Embedding the runtime consists of various steps: 
 * Embedding the runtime.
 
        Embedding the runtime consists of various steps: 
        not interfere with code in other domains.  This is useful if
        you want to host different applications in your program.  
 
        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:
+       Now, it is necessary to transfer control to Mono, and setup
+       the threading infrastructure, you do this like this:
+
+               void *user_data = NULL;
+
+               mono_runtime_exec_managed_code (domain, main_thread_handler, user_data);
+
+       Where your main_thread_handler can load your assembly and execute it:
+
+       static void main_thread_handler (gpointer user_data)
 
                MonoAssembly *assembly;
 
 
                MonoAssembly *assembly;
 
        layer, so in each file where you use pthread.h you should
        include the <gc/gc.h> file.  
 
        layer, so in each file where you use pthread.h you should
        include the <gc/gc.h> file.  
 
+       If you can not do this for any reasons, just remember that you
+       can not store pointers to Mono Objects on the stack, you can
+       store them safely in the heap, or in global variables though
+
 * Exposing C code to the CIL universe
 
        The Mono runtime provides two mechanisms to expose C code to
 * Exposing C code to the CIL universe
 
        The Mono runtime provides two mechanisms to expose C code to