B
bonk
Hello,
I am currently trying to wrap my head around what actually happens when
I compile a normal (native) c++ class with the /CLR Flag in Visual C++
2005 (C++/CLI).
Suppose I have the following class deklared in c++:
// #pragma managed or #pragma unmanaged
// does not seem to make any differnce here
class MyNativeClass
{
public:
int iValue;
public:
void DoSomething(double param)
{
// do something here
}
virtual ~MyNativeClass();
};
If compile that with /CLR we get the follow typedenfintion in the
Assembly (IL)
..class private sequential ansi sealed beforefieldinit MyNativeClass
extends [mscorlib]System.ValueType
{
.custom instance void
[mscorlib]System.Runtime.CompilerServices.NativeCppClassAttribute::.ctor()
.custom instance void
[Microsoft.VisualC]Microsoft.VisualC.MiscellaneousBitsAttribute::.ctor(int32)
= ( int32(0x00000040) )
.custom instance void
[Microsoft.VisualC]Microsoft.VisualC.DebugInfoInPDBAttribute::.ctor()
}
Now where did the Members (iValue and DoSomething) of that Type go?
Not only that they vanished, none of the Attributes listed here hints
where the CLR has to look for the Method implemenetation or for iVlaue.
Are the members compiled to IL too? If so where do I find them? Or are
they compiled to machinecode? That can't be, sinc it is possible to
compile that class with /CLRure too and as far as I understand
/CLRure prohibits machinecode. How does the CLR know where to look for
the members?
I am currently trying to wrap my head around what actually happens when
I compile a normal (native) c++ class with the /CLR Flag in Visual C++
2005 (C++/CLI).
Suppose I have the following class deklared in c++:
// #pragma managed or #pragma unmanaged
// does not seem to make any differnce here
class MyNativeClass
{
public:
int iValue;
public:
void DoSomething(double param)
{
// do something here
}
virtual ~MyNativeClass();
};
If compile that with /CLR we get the follow typedenfintion in the
Assembly (IL)
..class private sequential ansi sealed beforefieldinit MyNativeClass
extends [mscorlib]System.ValueType
{
.custom instance void
[mscorlib]System.Runtime.CompilerServices.NativeCppClassAttribute::.ctor()
.custom instance void
[Microsoft.VisualC]Microsoft.VisualC.MiscellaneousBitsAttribute::.ctor(int32)
= ( int32(0x00000040) )
.custom instance void
[Microsoft.VisualC]Microsoft.VisualC.DebugInfoInPDBAttribute::.ctor()
}
Now where did the Members (iValue and DoSomething) of that Type go?
Not only that they vanished, none of the Attributes listed here hints
where the CLR has to look for the Method implemenetation or for iVlaue.
Are the members compiled to IL too? If so where do I find them? Or are
they compiled to machinecode? That can't be, sinc it is possible to
compile that class with /CLRure too and as far as I understand
/CLRure prohibits machinecode. How does the CLR know where to look for
the members?