Created
January 3, 2018 19:04
-
-
Save lambdageek/98c229b07f08c7dc3d8308fc45a0de1c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
MonoObjectHandle | |
mono_runtime_try_invoke_handle (MonoMethod *method, MonoObjectHandle obj, void **params, MonoObjectHandleOut exc, MonoError* error) | |
{ | |
MONO_REQ_GC_UNSAFE_MODE; | |
HANDLE_FUNCTION_ENTER () | |
g_assert (exc != NULL); | |
if (mono_runtime_get_no_exec ()) | |
g_warning ("Invoking method '%s' when running in no-exec mode.\n", mono_method_full_name (method, TRUE)); | |
MonoObject* exc_raw = NULL; | |
MonoObject* ret_raw = do_runtime_invoke (method, MONO_HANDLE_RAW (obj), params, &exc_raw, error); | |
MONO_HANDLE_ASSIGN (exc, MONO_HANDLE_NEW (MonoObject, exc_raw)); | |
// REVIEW/test save a handle if it works | |
//MONO_HANDLE_DCL (MonoObject, ret); | |
//HANDLE_FUNCTION_RETURN_VAL (ret); | |
HANDLE_FUNCTION_RETURN_REF (MonoObject, MONO_HANDLE_NEW (MonoObject, ret_raw)); | |
} | |
/* Invoke caller example*/ | |
static int | |
example_caller (MonoObjectHandle something, MonoMethod* m, MonoError *error) { | |
HANDLE_FUNCTION_ENTER (); | |
error_init (error); | |
MonoExceptionHandle exc = MONO_HANDLE_NEW (MonoException, NULL); | |
MonoObjectHandle result = mono_runtime_try_invoke_handle (something, m, NULL, exc, error); | |
int ans; | |
if (!MONO_HANDLE_IS_NULL (exc)) { | |
ans = 1; | |
} else { | |
ans = 2; | |
} | |
HANDLE_FUNCTION_RETURN_VAL (ans); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment