سؤال

When sending data up and down the layers between C# and C++/CX, do i need to pin the data, before I was using the GCHandleType.Pinned, do I still need it, or not as now I have migrated to C++/CX ? if so how should I do it ? the same way as before ?

Thanks !!

هل كانت مفيدة؟

المحلول

I don't think you should need to pin data. Pinning meant that the garbage collector would not compact your object, causing native pointer references to go awry. With WinRT, your class is a COM object, which is reference-counted, not garbage-collected. So the object lives on the native heap and will not be compacted/relocated.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top