dimanche 27 décembre 2015

Reflection on CLR C++ code with dotPeek

I have this code written in CLR c++ :

namespace NS{
public class B {
public:
    B()
    {
        int k = 1 + 1;
    }
    static int K;
    int getId()
    {
        return 0;
    }
    static double getId2()
    {
        return 0;
    }
};
}

I compile it to dll and use DotPeek and I am getting this result :

namespace NS
{
[CLSCompliant(false)]
[NativeCppClass]}
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct B
{
}
}

And also using C# reflection like this :

var module = Assembly.Load("MyCLRCPP").Modules.First();
foreach (var data in module.GetFields())
{
  Debug.WriteLine(data.Name);
 }

I get only some gibberish :

__unep@?DoNothing@DefaultDomain@@@$$FCGJPAX@Z __unep@?_UninitializeDefaultDomain@LanguageSupport@@@$$FCGJPAX@Z

My question is : Why there is no code there?





Aucun commentaire:

Enregistrer un commentaire