-----Original Message-----
NigelW wrote: Clarification needed please.
If I compile a C++ program with the /clr option
inpsection of the resulting assembly with ILDASM shows MSIL even
for methods in classes for which I have not specified
garbage collection with __gc.
Am I correct in thinking there is really two kinds of
managed (i.e. MSIL) code from C++, that which uses
garbage collection and that which does not?
No, you are incorrect. Using the /clr option will compile
almost all C++code to MSIL whether the types involved are __gc,
__value, or __nogc ( thedefault ). There are only a few C++ constructs which will
not be compiled toMSIL and these are outlined in the MC++ language
specification, section 24.1.. Everything else, when /clr is used, is compiled to
MSIL whether managed orunmanaged.
.
Thank you for confirming nearly all C++ gets compiled to
MSIL when the /clr option is used. So I know see MSIL can
be used in managed or unmanaged ways (I was confused
because the documentation always equates unmanaged to
native).
In Section 24.1 of the C++ language spec. it says method
calls through pointers, including to virtual functions
through the vtable, cannot be compiled to MSIL. However,
examination of the MSIL for several methods calling
virtual functions shows that virtual methods can in fact
be used without preventing compilation to MSIL. Can you
shed any light on this discrepancy?
Thank you