Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>

        public void Save()
        {
            //
            //  Note :- Call this (Save ) method only after
            //  Compilation of All statements....
            _type_builder.CreateType();

            //
            // Retrieve the Entry Point from TModule....
            //
            MethodBuilder mb = _p._get_entry_point("MAIN");

            if (mb != null)
            {
                //
                // Here we will set the Assembly as a Console Application...
                // We will also set the Entry Point....
                //
                _asm_builder.SetEntryPoint(mb, PEFileKinds.ConsoleApplication);
            }
            //
            // Write the Resulting Executable...
            //

            _asm_builder.Save(_name);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cont"></param>
        /// <returns></returns>
        public override bool Compile(DNET_EXECUTABLE_GENERATION_CONTEXT cont)
        {
            if (m_proc == null)
            {
                // if it is  a recursive call..
                // resolve the address...
                m_proc = cont.GetProgram().Find(_procname);
            }

            string name = m_proc.Name;


            TModule       str = cont.GetProgram();
            MethodBuilder bld = str._get_entry_point(name);

            foreach (Exp ex in m_actuals)
            {
                ex.Compile(cont);
            }
            cont.CodeOutput.Emit(OpCodes.Call, bld);
            return(true);
        }