private void interrogate() { m_name = Utilities.getString(m_native.Name()); m_descr = Utilities.getString(m_native.Description()); m_type = m_native.Type(); m_typeInfo = ProxyTypes.getTypeInfo(m_type); m_readOnly = m_native.isReadOnly(); m_callbackRef = false; CppNativeProxy.Callback callback = CppNativeProxy.CreateCallin(m_catcher, typeof(Native.IAttributeObserver)); System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { m_callback = callback; m_callback.DangerousAddRef(ref m_callbackRef); m_native.Observe(m_callback.DangerousGetHandle()); } }
void detached() { if (m_callback != null) { System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { if (m_callbackRef) m_callback.DangerousRelease(); m_callback = null; } } }
public CppNativeProxy.Callback createCallin() { if (callback == null) callback = CppNativeProxy.CreateCallin(this, typeof(Native.IVector)); bool success = false; callback.DangerousAddRef(ref success); if (!success) throw new ApplicationException("AddRef failed"); return callback; }
protected virtual void Dispose(bool disposing) { if (m_callback != null) { CppNativeProxy.Callback callback = m_callback; System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { m_native.Unobserve(m_callback.DangerousGetHandle()); if (m_callbackRef) m_callback.DangerousRelease(); m_callback = null; } if (disposing) callback.Dispose(); } if (m_nativeRef != IntPtr.Zero) { Registration.removeObject(m_nativeRef); m_nativeRef = IntPtr.Zero; } }
public VectorProvider(ITypeMarshaller inner, Array data) { innerType = inner; size = (uint)data.Length; pinArray = innerType.toPinnableArray(data); pin = GCHandle.Alloc(pinArray, GCHandleType.Pinned); callback = null; }