Monobjc.Tools.Generators.NativeCodeGenerator.Link C# (CSharp) Method

Link() private method

private Link ( String directory, String objectFile, String outputFile, String nativeOptions, String>.List assemblies, String>.List configurations, String>.Dictionary machineConfig ) : void
directory String
objectFile String
outputFile String
nativeOptions String
assemblies String>.List
configurations String>.List
machineConfig String>.Dictionary
return void
        private void Link(String directory, String objectFile, String outputFile, String nativeOptions, List<Dictionary<String, String>> assemblies, List<Dictionary<String, String>> configurations, Dictionary<String, String> machineConfig)
        {
            // Build the command line
            StringBuilder builder = new StringBuilder();
            builder.AppendFormat(" {0} -L\"{1}\" ", nativeOptions, directory);
            builder.AppendFormat(" {0} ", this.NativeLDFLAGS ?? String.Empty);

            // Add the pkg-config flags for Mono
            String monoLibrary = this.UseSGEN ? "monosgen-2" : "mono-2";
            using (ProcessHelper helper = new ProcessHelper("pkg-config", String.Format("{0} {1}", "--libs", monoLibrary)))
            {
                helper.Logger = this.Logger;
                String result = helper.ExecuteAndReturnOutput ();
                result = result.Replace("\n", String.Empty);
                builder.Append(result);
            }

            // Add zlib shared library
            if (this.Compress) {
                builder.Append(" -lz ");
            }

            // Add Monobjc shared library
            builder.AppendFormat(" -lmonobjc ");

            // Add all the static libraries
            foreach (Dictionary<string, string> dictionary in assemblies)
            {
                builder.AppendFormat(" -l{0}", dictionary[KEY_SYMBOL]);
            }
            foreach (Dictionary<string, string> dictionary in configurations)
            {
                builder.AppendFormat(" -l{0}", dictionary[KEY_SYMBOL]);
            }
            if (machineConfig != null)
            {
                builder.AppendFormat(" -l{0}", machineConfig[KEY_SYMBOL]);
            }

            // Append required framework for Receigen
            if (this.UseReceigen) {
                builder.AppendFormat(" -framework {0}", "AppKit");
                builder.AppendFormat(" -framework {0}", "Foundation");
                //builder.AppendFormat(" -framework {0}", "Security");
                //builder.AppendFormat(" -framework {0}", "IOKit");
            }

            builder.AppendFormat(" -o \"{0}\" \"{1}\" ", outputFile, objectFile);

            // TODO: I18N
            this.Logger.LogInfo("Linking...");
            this.Logger.LogDebug(String.Format("Arguments: '{0}'", builder.ToString()));
            using (ProcessHelper helper = new ProcessHelper(this.NativeCompiler, builder.ToString()))
            {
                helper.Logger = this.Logger;
                helper.Execute();
            }
        }