//
using System;
+
+#if STATIC
+using IKVM.Reflection;
+using IKVM.Reflection.Emit;
+#else
using System.Reflection;
using System.Reflection.Emit;
+#endif
using Mono.CompilerServices.SymbolWriter;
{
static class SymbolWriter
{
-#if !NET_4_0
+#if !NET_4_0 && !STATIC
delegate int GetILOffsetFunc (ILGenerator ig);
static GetILOffsetFunc get_il_offset_func;
delegate Guid GetGuidFunc (ModuleBuilder mb);
static GetGuidFunc get_guid_func;
- static SymbolWriter ()
+ static void Initialize ()
{
var mi = typeof (ILGenerator).GetMethod (
"Mono_GetCurrentOffset",
static int GetILOffset (ILGenerator ig)
{
-#if NET_4_0
+#if NET_4_0 || STATIC
return ig.ILOffset;
#else
+ if (get_il_offset_func == null)
+ Initialize ();
+
return get_il_offset_func (ig);
#endif
}
public static Guid GetGuid (ModuleBuilder module)
{
-#if NET_4_0
+#if NET_4_0 || STATIC
return module.ModuleVersionId;
#else
+ if (get_guid_func == null)
+ Initialize ();
+
return get_guid_func (module);
#endif
}