Created
August 16, 2017 02:18
-
-
Save 7Hazard/c9a9342f51861c093c347037e1477e2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Invoke(MonoDomain* domain, MonoMethod* method, MonoObject* obj, void** args, bool threaded) { | |
if (threaded) { | |
mono_thread_attach(domain); | |
} | |
MonoObject** exc; | |
try { | |
mono_runtime_invoke(method, obj, args, exc); | |
} | |
catch (MonoObject* obj) | |
{ | |
printf("Catch MonoObject* stub\n"); | |
MonoString* StringOutput = mono_object_to_string(obj, NULL); | |
char* output = mono_string_to_utf8(StringOutput); | |
printf("Our ToString is this:\n%s\n", output); | |
} | |
catch (MonoObject** obj) | |
{ | |
printf("Catch MonoObject** stub\n"); | |
MonoString* StringOutput = mono_object_to_string(*obj, NULL); | |
char* output = mono_string_to_utf8(StringOutput); | |
printf("Our ToString is this:\n%s\n", output); | |
} | |
catch (void** obj) | |
{ | |
printf("Catch void** stub\n"); | |
MonoString* StringOutput = mono_object_to_string((MonoObject*)*obj, NULL); | |
char* output = mono_string_to_utf8(StringOutput); | |
printf("Our ToString is this:\n%s\n", output); | |
} | |
catch (void* obj) | |
{ | |
printf("Catch void* stub\n"); | |
MonoString* StringOutput = mono_object_to_string((MonoObject*)obj, NULL); | |
char* output = mono_string_to_utf8(StringOutput); | |
printf("Our ToString is this:\n%s\n", output); | |
} | |
catch (...) | |
{ | |
printf("Catch all stub\n"); | |
MonoString* StringOutput = mono_object_to_string(*exc, NULL); | |
char* output = mono_string_to_utf8(StringOutput); | |
printf("Our ToString is this:\n%s\n", output); | |
} | |
//HasException(exc); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment