3c6daee652
Former-commit-id: f069081cc0821095435a845c961ae61cbbc95121
578 lines
17 KiB
HTML
578 lines
17 KiB
HTML
<?xml version="1.0" encoding="utf-8"?><span>
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>mono-api-methods.html</title>
|
|
<style type="text/css">
|
|
|
|
|
|
h3 {
|
|
font-size: 18px;
|
|
padding-bottom: 4pt;
|
|
border-bottom: 2px solid #dddddd;
|
|
}
|
|
|
|
.api {
|
|
border: 1px solid;
|
|
padding: 10pt;
|
|
margin: 10pt;
|
|
}
|
|
|
|
.api-entry {
|
|
border-bottom: none;
|
|
font-size: 18px;
|
|
}
|
|
|
|
.prototype {
|
|
border: 1px solid;
|
|
background-color: #f2f2f2;
|
|
padding: 5pt;
|
|
margin-top: 5pt;
|
|
margin-bottom: 5pt;
|
|
}
|
|
|
|
.header {
|
|
border: 1px solid;
|
|
padding: 0 0 5pt 5pt;
|
|
margin: 10pt;
|
|
white-space: pre;
|
|
font-family: monospace;
|
|
}
|
|
|
|
.code {
|
|
border: 1px solid;
|
|
padding: 0 0 5pt 5pt;
|
|
margin: 10pt;
|
|
white-space: pre;
|
|
font-family: monospace;
|
|
}
|
|
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h3>Methods</h3>
|
|
|
|
<h3>Invoking Methods</h3>
|
|
|
|
<a name="api:mono_runtime_invoke"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_runtime_invoke</div>
|
|
|
|
<div class="prototype">MonoObject*
|
|
mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>method:</i></dt><dd> method to invoke</dd><dt><i>obJ:</i></dt><dd> object instance</dd><dt><i>params:</i></dt><dd> arguments to the method</dd><dt><i>exc:</i></dt><dd> exception information.</dd></blockquote>
|
|
<b>Remarks</b>
|
|
<p />
|
|
Invokes the method represented by <i>method</i> on the object <i>obj</i>.
|
|
|
|
obj is the 'this' pointer, it should be NULL for static
|
|
methods, a MonoObject* for object instances and a pointer to
|
|
the value type for value types.
|
|
|
|
The params array contains the arguments to the method with the
|
|
same convention: MonoObject* pointers for object instances and
|
|
pointers to the value type otherwise.
|
|
|
|
<p />
|
|
From unmanaged code you'll usually use the
|
|
mono_runtime_invoke() variant.
|
|
|
|
Note that this function doesn't handle virtual methods for
|
|
you, it will exec the exact method you pass: we still need to
|
|
expose a function to lookup the derived class implementation
|
|
of a virtual method (there are examples of this in the code,
|
|
though).
|
|
|
|
<p />
|
|
You can pass NULL as the exc argument if you don't want to
|
|
catch exceptions, otherwise, *exc will be set to the exception
|
|
thrown, if any. if an exception is thrown, you can't use the
|
|
MonoObject* result from the function.
|
|
|
|
<p />
|
|
If the method returns a value type, it is boxed in an object
|
|
reference.
|
|
|
|
|
|
If you want to invoke generic methods, you must call the method on the
|
|
"inflated" class, which you can obtain from the
|
|
<tt>mono_object_get_class()</tt>
|
|
|
|
<div class="code">
|
|
MonoClass *clazz;
|
|
MonoMethod *method;
|
|
|
|
clazz = mono_object_get_class (obj);
|
|
|
|
/*
|
|
* If there are more Add methods declared, you
|
|
* may use mono_method_desc_search_in_class (clazz, ":Add(T)"),
|
|
* you must substitute ":Add(T)" with the correct type, for example
|
|
* for List<int>, you would use ":Add(int)".
|
|
*/
|
|
method = mono_class_get_method_from_name (clazz, "Add", 1);
|
|
mono_runtime_invoke (method, obj, args, &exception);
|
|
</div>
|
|
|
|
|
|
</div> <a name="api:mono_runtime_invoke_array"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_runtime_invoke_array</div>
|
|
|
|
<div class="prototype">MonoObject*
|
|
mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
|
|
MonoObject **exc)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>method:</i></dt><dd> method to invoke</dd><dt><i>obJ:</i></dt><dd> object instance</dd><dt><i>params:</i></dt><dd> arguments to the method</dd><dt><i>exc:</i></dt><dd> exception information.</dd></blockquote>
|
|
<b>Remarks</b>
|
|
<p />
|
|
Invokes the method represented by <i>method</i> on the object <i>obj</i>.
|
|
|
|
obj is the 'this' pointer, it should be NULL for static
|
|
methods, a MonoObject* for object instances and a pointer to
|
|
the value type for value types.
|
|
|
|
The params array contains the arguments to the method with the
|
|
same convention: MonoObject* pointers for object instances and
|
|
pointers to the value type otherwise. The _invoke_array
|
|
variant takes a C# object[] as the params argument (MonoArray
|
|
*params): in this case the value types are boxed inside the
|
|
respective reference representation.
|
|
|
|
<p />
|
|
From unmanaged code you'll usually use the
|
|
mono_runtime_invoke() variant.
|
|
|
|
Note that this function doesn't handle virtual methods for
|
|
you, it will exec the exact method you pass: we still need to
|
|
expose a function to lookup the derived class implementation
|
|
of a virtual method (there are examples of this in the code,
|
|
though).
|
|
|
|
<p />
|
|
You can pass NULL as the exc argument if you don't want to
|
|
catch exceptions, otherwise, *exc will be set to the exception
|
|
thrown, if any. if an exception is thrown, you can't use the
|
|
MonoObject* result from the function.
|
|
|
|
<p />
|
|
If the method returns a value type, it is boxed in an object
|
|
reference.
|
|
|
|
</div> <a name="api:mono_runtime_delegate_invoke"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_runtime_delegate_invoke</div>
|
|
|
|
<div class="prototype">MonoObject*
|
|
mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **exc)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>delegate:</i></dt><dd> pointer to a delegate object.</dd><dt><i>params:</i></dt><dd> parameters for the delegate.</dd><dt><i>exc:</i></dt><dd> Pointer to the exception result.</dd></blockquote>
|
|
<b>Remarks</b>
|
|
<p />
|
|
Invokes the delegate method <i>delegate</i> with the parameters provided.
|
|
|
|
You can pass NULL as the exc argument if you don't want to
|
|
catch exceptions, otherwise, *exc will be set to the exception
|
|
thrown, if any. if an exception is thrown, you can't use the
|
|
MonoObject* result from the function.
|
|
|
|
|
|
</div> <a name="api:mono_method_body_get_object"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_body_get_object</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_body_get_object</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_desc_free"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_free</div>
|
|
|
|
<div class="prototype">void
|
|
mono_method_desc_free (MonoMethodDesc *desc)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>desc:</i></dt><dd> method description to be released</dd></blockquote>
|
|
<b>Remarks</b>
|
|
<p />
|
|
Releases the MonoMethodDesc object <i>desc</i>.
|
|
|
|
</div> <a name="api:mono_method_desc_from_method"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_from_method</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_desc_from_method</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_desc_full_match"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_full_match</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_desc_full_match</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_desc_match"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_match</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_desc_match</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_desc_new"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_new</div>
|
|
|
|
<div class="prototype">MonoMethodDesc*
|
|
mono_method_desc_new (const char *name, gboolean include_namespace)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>name:</i></dt><dd> the method name.</dd><dt><i>include_namespace:</i></dt><dd> whether the name includes a namespace or not.</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> a parsed representation of the method description.
|
|
</blockquote>
|
|
<b>Remarks</b>
|
|
<p />
|
|
Creates a method description for <i>name</i>, which conforms to the following
|
|
specification:
|
|
|
|
[namespace.]classname:methodname[(args...)]
|
|
|
|
in all the loaded assemblies.
|
|
|
|
Both classname and methodname can contain '*' which matches anything.
|
|
|
|
|
|
</div> <a name="api:mono_method_desc_search_in_class"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_search_in_class</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_desc_search_in_class</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_desc_search_in_image"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_desc_search_in_image</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_desc_search_in_image</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_full_name"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_full_name</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_full_name</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_class"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_class</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_class</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_flags"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_flags</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_flags</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_last_managed"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_last_managed</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_last_managed</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_marshal_info"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_marshal_info</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_marshal_info</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_name"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_name</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_name</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_object"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_object</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_object</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_param_names"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_param_names</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_param_names</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_param_token"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_param_token</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_param_token</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_signature"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_signature</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_signature</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_index"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_index</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_index</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_signature_full"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_signature_full</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_signature_full</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_get_token"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_token</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_token</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_has_marshal_info"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_has_marshal_info</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_has_marshal_info</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_verify"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_verify</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_verify</div>
|
|
<p />
|
|
|
|
|
|
</div><h3>Method Signatures</h3>
|
|
|
|
<a name="api:mono_method_signature"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_signature</div>
|
|
|
|
<div class="prototype">MonoMethodSignature*
|
|
mono_method_signature (MonoMethod *m)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Remarks</b>
|
|
<p />
|
|
Return the signature of the method M. On failure, returns NULL.
|
|
|
|
</div> <a name="api:mono_signature_explicit_this"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_explicit_this</div>
|
|
|
|
<div class="prototype">gboolean
|
|
mono_signature_explicit_this (MonoMethodSignature *sig)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> <i>TRUE</i> if this the method signature <i>sig</i> has an explicit
|
|
|
|
instance argument. <i>FALSE</i> otherwise.</blockquote>
|
|
|
|
</div> <a name="api:mono_signature_get_call_conv"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_get_call_conv</div>
|
|
|
|
<div class="prototype">guint32
|
|
mono_signature_get_call_conv (MonoMethodSignature *sig)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> the call convention of the method signature <i>sig</i>.
|
|
</blockquote>
|
|
|
|
</div> <a name="api:mono_signature_get_desc"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_get_desc</div>
|
|
|
|
<div class="prototype">Prototype: mono_signature_get_desc</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_signature_get_param_count"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_get_param_count</div>
|
|
|
|
<div class="prototype">guint32
|
|
mono_signature_get_param_count (MonoMethodSignature *sig)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> the number of parameters in the method signature <i>sig</i>.
|
|
</blockquote>
|
|
|
|
</div> <a name="api:mono_signature_get_params"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_get_params</div>
|
|
|
|
<div class="prototype">MonoType*
|
|
mono_signature_get_params (MonoMethodSignature *sig, gpointer *iter)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd><dt><i>iter:</i></dt><dd> pointer to an iterator</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> the next parameter type of the method signature <i>sig</i>,
|
|
|
|
<i>NULL</i> when finished.</blockquote>
|
|
<b>Remarks</b>
|
|
<p />
|
|
Iterates over the parameters for the method signature <i>sig</i>.
|
|
A void* pointer must be initualized to <i>NULL</i> to start the iteration
|
|
and it's address is passed to this function repeteadly until it returns
|
|
<i>NULL</i>.
|
|
|
|
|
|
</div> <a name="api:mono_signature_get_return_type"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_get_return_type</div>
|
|
|
|
<div class="prototype">MonoType*
|
|
mono_signature_get_return_type (MonoMethodSignature *sig)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> the return type of the method signature <i>sig</i>
|
|
</blockquote>
|
|
|
|
</div> <a name="api:mono_signature_hash"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_hash</div>
|
|
|
|
<div class="prototype">Prototype: mono_signature_hash</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_signature_is_instance"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_is_instance</div>
|
|
|
|
<div class="prototype">gboolean
|
|
mono_signature_is_instance (MonoMethodSignature *sig)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> <i>TRUE</i> if this the method signature <i>sig</i> has an implicit
|
|
|
|
first instance argument. <i>FALSE</i> otherwise.</blockquote>
|
|
|
|
</div> <a name="api:mono_signature_vararg_start"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_signature_vararg_start</div>
|
|
|
|
<div class="prototype">int
|
|
mono_signature_vararg_start (MonoMethodSignature *sig)
|
|
|
|
</div>
|
|
<p />
|
|
<b>Parameters</b>
|
|
<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
|
|
<b>Returns</b>
|
|
<blockquote> the number of the first vararg parameter in the
|
|
|
|
method signature <i>sig</i>. -1 if this is not a vararg signature.</blockquote>
|
|
|
|
</div> <a name="api:mono_param_get_objects"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_param_get_objects</div>
|
|
|
|
<div class="prototype">Prototype: mono_param_get_objects</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_get_method_full"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_get_method_full</div>
|
|
|
|
<div class="prototype">Prototype: mono_get_method_full</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_get_method"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_get_method</div>
|
|
|
|
<div class="prototype">Prototype: mono_get_method</div>
|
|
<p />
|
|
|
|
|
|
</div><h3>Methods Header Operations</h3>
|
|
|
|
<a name="api:mono_method_get_header"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_get_header</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_get_header</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_header_get_clauses"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_header_get_clauses</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_header_get_clauses</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_header_get_code"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_header_get_code</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_header_get_code</div>
|
|
<p />
|
|
|
|
</div> <a name="api:mono_method_header_get_locals"></a>
|
|
<div class="api">
|
|
<div class="api-entry">mono_method_header_get_locals</div>
|
|
|
|
<div class="prototype">Prototype: mono_method_header_get_locals</div>
|
|
<p />
|
|
|
|
</div></body>
|
|
</html>
|
|
</span> |