[Mono-dev] Mono API: field type attributes

Robert Jordan robertj at gmx.net
Thu Jul 15 11:00:06 EDT 2010


On 15.07.2010 16:55, David Yuste wrote:
> Hello,
>
>    This is my first mail here. I'm David Yuste, I'm working in the gcc
> branch gcc4cli.  The whole project also includes a GCC front-end for
> CLI, which uses the Mono parser. The front end interacts with Mono
> through the Mono API.
>
>    The problem that I have is that I need to check whether a field is
> declared as 'static' or not, given a MonoClassField pointer. Inside
> Mono, it can be done just by checking 'field->type->attrs&
> FIELD_ATTRIBUTE_STATIC', but this is not possible using the API.
>
>    I've been looking for some function providing such information, but
> I didn't found any way. Do you have any suggestion?

mono_field_get_flags ().

MonoClassField *field = ...
int flags = mono_field_get_flags (field);
if (flags & MONO_FIELD_ATTR_STATIC)
	....

Robert



More information about the Mono-devel-list mailing list