Created
March 15, 2009 03:12
-
-
Save nilium/79287 to your computer and use it in GitHub Desktop.
Alternate method of handling exceptions in TMonoMethod.Invoke
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
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