X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=docs%2Fembedded-api;h=76f45f8be7319efbb76cf1c51c56fa94fa806e27;hb=b93484ca6b0f32663680a9abf616f24b140de755;hp=1fd739ae2ba82eda4fbb23486982cd6fabf74f7d;hpb=24a7667524f1e4b5d722c45cd69e63a9f905cf56;p=mono.git diff --git a/docs/embedded-api b/docs/embedded-api index 1fd739ae2ba..76f45f8be73 100644 --- a/docs/embedded-api +++ b/docs/embedded-api @@ -69,7 +69,16 @@ 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; @@ -112,6 +121,10 @@ layer, so in each file where you use pthread.h you should include the 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