Q
QbProg
Hello,
I did some experiments with VC++ 2005, and some ILDasm. Please tell me
if I have understood the concepts of C++ programming under .NET, since
I'm a bit confused!
--
There are 4 types of classes in VC++/CLI:
Unmanaged classes (i.e. normal classes compiled in a unmanaged source
or dll , the code is unmanaged and CPU native). Accessible from C++/CLI
classes but only with a reference (pointer), require a
managed/unmanaged transition for each function call.
Native classes
Standard C++ classes that are compiled with /CLR enabled. These are
marked as native, use the same syntax as standard c++, but compile to
IL (and use the IL CRT). These are not accessible from C#/VB, etc...
but only from C++. Allow for a CLRure compilation, and the code
generated is effectively IL. (you can use framework classes). When an
unmanaged function is called a IJW stub is used.
I don't know if the term "native" is appropriate because on previous
versions it was used as synonym of "unmanaged". Anyway, using ILDasm I
see the "native" tag and IL code.
Value classes
Are .NET classes that can be defined only from C++/CLI, but can be
*used* from other languages too. Are effectively .NET classes value
classes, but could not be instantiated from C# VB. These suffer of many
limitations, so the port of existing C++ classes is not really
confortable.
Ref classes, are "ufficial" .NET classes , used in C++/VB, are accessed
with handles and garbage collected, bla bla bla
In C++ you can use Ref classes by value (and in C# it generates a
different syntax), anyway you need an explicit contructor and
copy/constructor.
--
It is correct? I'm a little confused about native classes. The lack of
value class support in C#/VB is not really good, because it makes
harder to port existing C++ code....
least into CLI.... (and that is REALLY good)
Tell me if I'm wrong...
Thanks and sorry for my English!!
QbProg
I did some experiments with VC++ 2005, and some ILDasm. Please tell me
if I have understood the concepts of C++ programming under .NET, since
I'm a bit confused!
--
There are 4 types of classes in VC++/CLI:
Unmanaged classes (i.e. normal classes compiled in a unmanaged source
or dll , the code is unmanaged and CPU native). Accessible from C++/CLI
classes but only with a reference (pointer), require a
managed/unmanaged transition for each function call.
Native classes
Standard C++ classes that are compiled with /CLR enabled. These are
marked as native, use the same syntax as standard c++, but compile to
IL (and use the IL CRT). These are not accessible from C#/VB, etc...
but only from C++. Allow for a CLRure compilation, and the code
generated is effectively IL. (you can use framework classes). When an
unmanaged function is called a IJW stub is used.
I don't know if the term "native" is appropriate because on previous
versions it was used as synonym of "unmanaged". Anyway, using ILDasm I
see the "native" tag and IL code.
Value classes
Are .NET classes that can be defined only from C++/CLI, but can be
*used* from other languages too. Are effectively .NET classes value
classes, but could not be instantiated from C# VB. These suffer of many
limitations, so the port of existing C++ classes is not really
confortable.
Ref classes, are "ufficial" .NET classes , used in C++/VB, are accessed
with handles and garbage collected, bla bla bla
In C++ you can use Ref classes by value (and in C# it generates a
different syntax), anyway you need an explicit contructor and
copy/constructor.
--
It is correct? I'm a little confused about native classes. The lack of
value class support in C#/VB is not really good, because it makes
harder to port existing C++ code....
managed/unmanaged transitions and to port easily your existing code atFrom what I've understood, Native classes are the key feature to avoid
least into CLI.... (and that is REALLY good)
Tell me if I'm wrong...
Thanks and sorry for my English!!
QbProg