jakesays-old / runsharp

Automatically exported from code.google.com/p/runsharp
MIT License
1 stars 0 forks source link

Out parameter was not generated properly #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce the bug:

        public static void GenFoo(AssemblyGen tg)
        {
            TypeGen g = tg.Public.Class("OutParameterBug.Foo");
            {
                CodeGen cg = g.Public.Method(typeof(void),
"OutParamMethod").Out.Parameter(typeof(long), "l");
                {
                    cg.Assign(cg.Arg("l"), 0);
                }
            }
        }

Expected:
    .method public hidebysig instance void OutParamMethod([out] int64& l)
cil managed

But actual generated IL code that is missing [out]:
    .method public hidebysig instance void OutParamMethod(int64& l) cil managed
    {
        .maxstack 2
        L_0000: ldarg.1 
        L_0001: ldc.i4.0 
        L_0002: conv.i8 
        L_0003: stind.i8 
        L_0004: ret 
    }

Original issue reported on code.google.com by kenne...@gmail.com on 29 Oct 2009 at 3:47

GoogleCodeExporter commented 9 years ago
I believe this is mostly a cosmetic issue and shouldn't affect the runnability 
of the 
code in any way, since ref and out parameters are the same beast internally, 
and only 
have different compile-time semantics.

Original comment by StefanSi...@gmail.com on 22 Dec 2009 at 11:13

GoogleCodeExporter commented 9 years ago

Original comment by StefanSi...@gmail.com on 22 Dec 2009 at 11:13

GoogleCodeExporter commented 9 years ago
What if you care to write the dynamic module to an dll file?

Original comment by kenne...@gmail.com on 22 Dec 2009 at 8:13

GoogleCodeExporter commented 9 years ago
Well, it'll probably force you to initialize the holders for out parameters 
before calling the method, and write ref 
instead of out ;) Anyway, it's trivial enough to be fixed in 0.2, which I hope 
will be sometime during holidays.

Original comment by StefanSi...@gmail.com on 23 Dec 2009 at 9:43