public void GenerateAssemblyLoad()
        {
            var assemblyName     = Unit.FileName;
            var assemblyLookupId = GeneratedIdentifier($"lookup_assembly_{assemblyName.Replace('.', '_')}");

            PushBlock();
            WriteLine($"static void {assemblyLookupId}()");
            WriteStartBraceIndent();

            var monoImageName = string.Format("{0}_image", CGenerator.AssemblyId(Unit));

            WriteLine("if ({0})", monoImageName);
            WriteLineIndent("return;");

            WriteLine("{0} = mono_embeddinator_load_assembly(&{1}, \"{2}\");",
                      monoImageName, GeneratedIdentifier("mono_context"), assemblyName);

            WriteCloseBraceIndent();
            PopBlock(NewLineKind.BeforeNextBlock);
        }
        public override void Process()
        {
            RemoveTypedefNodes();

            GenerateFilePreamble(CommentKind.BCPL, "Embeddinator-4000");

            PushBlock();
            WriteHeaders();
            PopBlock(NewLineKind.BeforeNextBlock);

            PushBlock();
            WriteLine("mono_embeddinator_context_t {0};", GeneratedIdentifier("mono_context"));
            WriteLine("MonoImage* {0}_image;", CGenerator.AssemblyId(Unit));
            PopBlock(NewLineKind.BeforeNextBlock);

            GenerateObjectDeclarations();

            GenerateGlobalMethods();

            VisitDeclContext(Unit);
        }
        public static string GenerateMonoClassFromNameCall(Declaration decl)
        {
            var namespaces = Declaration.GatherNamespaces(decl.Namespace)
                             .Where(ns => !(ns is TranslationUnit));

            var @namespace = string.Join(".", namespaces);
            var ids        = string.Join(", ",
                                         decl.QualifiedName.Split('.').Select(n => string.Format("\"{0}\"", n)));

            var monoImageName = string.Format("{0}_image", CGenerator.AssemblyId(decl.TranslationUnit));
            var managedName   = decl.ManagedQualifiedName();

            var dotIndex = managedName.LastIndexOf(".", StringComparison.Ordinal);

            if (dotIndex > 0)
            {
                managedName = managedName.Substring(managedName.LastIndexOf(".", StringComparison.Ordinal) + 1);
            }

            return($"mono_class_from_name({monoImageName}, \"{@namespace}\", \"{managedName}\");");
        }