示例#1
0
    int GenInterpToNative(String[] args)
    {
        if (args.Length < 2)
        {
            Usage();
            return(1);
        }
        string outfileName = args [1];

        args = args.Skip(2).ToArray();

        var assemblies = new List <AssemblyDefinition> ();

        foreach (var fname in args)
        {
            assemblies.Add(AssemblyDefinition.ReadAssembly(fname));
        }

        List <Pinvoke>         pinvokes;
        List <PinvokeCallback> callbacks;

        PInvokeTableGenerator.CollectPInvokes(assemblies, out pinvokes, out callbacks);

        var gen = new InterpToNativeGenerator();

        foreach (var pinvoke in pinvokes)
        {
            gen.AddSignature(pinvoke.Method);
        }
        using (var w = File.CreateText(outfileName)) {
            gen.Emit(w);
        }
        return(0);
    }
示例#2
0
    int GenInterpToNative(String[] args)
    {
        if (args.Length < 2)
        {
            Usage();
            return(1);
        }
        string outfileName = args [1];

        args = args.Skip(2).ToArray();

        pinvokes = new List <Pinvoke> ();
        foreach (var fname in args)
        {
            var a = AssemblyDefinition.ReadAssembly(fname);

            foreach (var type in a.MainModule.Types)
            {
                ProcessTypeForPinvoke(pinvokes, type);
                foreach (var nested in type.NestedTypes)
                {
                    ProcessTypeForPinvoke(pinvokes, nested);
                }
            }
        }

        var gen = new InterpToNativeGenerator();

        foreach (var pinvoke in pinvokes)
        {
            gen.AddSignature(pinvoke.Method);
        }
        using (var w = File.CreateText(outfileName)) {
            gen.Emit(w);
        }
        return(0);
    }