[Mono-list] Embedded API: static constructor calling

Robert Jordan robertj at gmx.net
Tue Oct 1 12:03:37 UTC 2013


On 01.10.2013 11:37, jonathan at mugginsoft.com wrote:
> Is it the case that calling a static field via the embedded API does not cause the static constructor to be run?
> This seems to be the behaviour I am observing.
>
> In the example below setting the static MetaDataXXX fields (before any other static access) does not cause the static constructor to be run and expected behaviour is lost.
> If I call a static warmup method first, which does trigger the constructor, then all is well.

You're supposed to call mono_runtime_class_init () on the vtable
of the class before calling mono_field_static_get/set.

Robert




More information about the Mono-list mailing list