Can the behaviour of pin_ptr be achieved directly in C++/CLI? For example, is it possible to write CLR code directly, something like asm
for native apps?
An example of what I would like to do is a wrapper for a pin_ptr
(impossible because of the restrictions on pin_ptr
s).
class WrappedPtr
{
public:
explicit WrappedPtr(String^ s)
{
pin = PtrToStringChars(s);
// I want to pin s for the lifetime of this object (only used on the stack)
}
};