E
Eric Twietmeyer
In the header file vcclr.h (in the .../Vc7/include directory of your
installation) there is an inlined function PtrToStringChars defined. This
is a utility function to get quick access to the internal chars of a
System::String object. I came across it by reading Peter Grimes's "Managed
Extensions for Visual C++.NET" published by MSPress.
In any case, its implementation makes no sense to me. The line that sets
offset calls the property OffsetToStringData on a static class called
RuntimeHelpers in the System::Runtime::CompilerServices namespace.
Strangely, there is no reference in this call to the property to the
underlying string, and yet the MSIL produces clearly shows that the String
reference is passed as the parameter to the get_OffsetToStringData method.
The syntax though in the c++ code does not indicate this in any way.
Clearly something strange is going on here. Does anyone have an
explanation? Is the compiler producing weird code because this is something
from the CompilerServices namespace, or do I not understand something about
managed c++ properties (very possible, I'm new to managed c++).
Very curious to understand what is going on. Thanks,
-Eric
installation) there is an inlined function PtrToStringChars defined. This
is a utility function to get quick access to the internal chars of a
System::String object. I came across it by reading Peter Grimes's "Managed
Extensions for Visual C++.NET" published by MSPress.
In any case, its implementation makes no sense to me. The line that sets
offset calls the property OffsetToStringData on a static class called
RuntimeHelpers in the System::Runtime::CompilerServices namespace.
Strangely, there is no reference in this call to the property to the
underlying string, and yet the MSIL produces clearly shows that the String
reference is passed as the parameter to the get_OffsetToStringData method.
The syntax though in the c++ code does not indicate this in any way.
Clearly something strange is going on here. Does anyone have an
explanation? Is the compiler producing weird code because this is something
from the CompilerServices namespace, or do I not understand something about
managed c++ properties (very possible, I'm new to managed c++).
Very curious to understand what is going on. Thanks,
-Eric