/clr:pure switch generates pure MSIL but it is not verifible. Native array and pointer can be used in this mode. Does that mean that there is a structure in MSIL to hold native arrays and pointers? If yes, I would like to ask how can I code MSIL native array and pointer?
/clr:pure switch generates pure MSIL but it is not verifible. Native array and pointer
Share
Yes, there is a type in CIL to represent unmanaged pointers. They are similar to managed pointers (
refandoutin C#,&in CIL), except that GC ignores them and you can do some arithmetic operations on them (those that make sense with pointers).Interestingly, the pointer type does contain information about the target type (so it’s e.g.
int32*), but all arithmetic operations are byte based.As an example, the following C++/CLI method:
produces the following CIL when it’s inside a
ref class(as reported by Reflector):