Hi Rodrigo, Rodrigo Kumpera wrote: > Hi Paolo, > > I think that mono_method_get_param_names should be changed to not require > the caller to > figure out the number of parameters. In adition to that, this function has > no way to return an > error back to the caller. > > My suggestion is to change it to > MonoError mono_method_get_param_names (MonoMethod *method, char **names, int > *params) > > On success names points to a g_malloc'd array of *params strings that come > from assembly memory. > On failure names and params are left untouched.
Speaking of which, besides the param names there is another bit of information not available from mono_method_* or mono_signature_*: the param attributes. I'm using this function to obtain them: /* * same semantics like mono_method_get_param_names */ void mono_method_get_param_attrs (MonoMethod *method, guint32 *attrs) { MonoClass *clazz = mono_method_get_class (method); MonoImage *image = mono_class_get_image (clazz); const MonoTableInfo *methodt, *paramt; guint32 idx; methodt = mono_image_get_table_info (image, MONO_TABLE_METHOD); paramt = mono_image_get_table_info (image, MONO_TABLE_PARAM); idx = mono_method_get_index (method); if (idx > 0) { guint param_index = mono_metadata_decode_row_col (methodt, idx - 1, MONO_METHOD_PARAMLIST); guint32 cols [MONO_PARAM_SIZE]; int i, lastp; if (idx < mono_table_info_get_rows (methodt)) lastp = mono_metadata_decode_row_col (methodt, idx, MONO_METHOD_PARAMLIST); else lastp = mono_table_info_get_rows (paramt) + 1; for (i = param_index; i < lastp; i++) { mono_metadata_decode_row (paramt, i - 1, cols, MONO_PARAM_SIZE); if (cols [MONO_PARAM_SEQUENCE]) attrs [cols [MONO_PARAM_SEQUENCE] - 1] = cols [MONO_PARAM_FLAGS]; } } } It would be nice to have a function which is able to obtain these infos at a time, maybe mono_method_get_param_infos () returning a MonoParamInfo* (TBD) array. Robert _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list