Skip to content

Instantly share code, notes, and snippets.

@nilium
Created March 15, 2009 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilium/79287 to your computer and use it in GitHub Desktop.
Save nilium/79287 to your computer and use it in GitHub Desktop.
Alternate method of handling exceptions in TMonoMethod.Invoke
Rem
bbdoc: Invoke the method. If an exception is passed, its internal pointer must be Null.
returns: A mono object containing the return data, or Null if an exception is thrown.
End Rem
Method Invoke:TMonoObject(obj:TMonoObject, params:Byte Ptr[], exception:TMonoObject)
Return InvokeByPointer(obj._pointer, params, exception)
End Method
Rem
bbdoc: Invoke the method. If an exception is passed, its internal pointer must be Null.
returns: A mono object containing the return data, or Null if an exception is thrown.
End Rem
Method InvokeByPointer:TMonoObject(obj:Byte Ptr, params:Byte Ptr[], exception:TMonoObject)
Local value:TMonoObject
Local exc_pointer:Byte Ptr Ptr = Null
Local invokeReturn:Byte Ptr = Null
If exception And exception._pointer <> Null Then
Throw "(TMonoMethod.InvokeByPointer) Failed to invoke method: exception._pointer is not Null"
EndIf
If exception <> Null Then
exc_pointer = Varptr exception._pointer
EndIf
invokeReturn = mono_runtime_invoke(_pointer, obj, params, exc_pointer)
If exception And exception._pointer <> Null Then
Return Null
EndIf
value = TMonoObject._create(invokeReturn)
Return value
End Method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment