Esempio n. 1
0
        public static object UnwrapTarget(object target)
        {
            //
            // If target is a managed wrapper, we should unwrap it and use its target for data binding
            // For example, you don't want to data bind against a KeyValuePairImpl<K, V> - you want the real
            // KeyValuePair<K, V>
            //
            object newTarget = McgComHelpers.UnboxManagedWrapperIfBoxed(target);

            if (newTarget != target)
            {
                return(newTarget);
            }

            if (target is __ComObject)
            {
                object winrtUnboxed = McgModuleManager.UnboxIfBoxed(target);
                if (winrtUnboxed != null)
                {
                    return(winrtUnboxed);
                }
            }

            return(target);
        }
Esempio n. 2
0
        public static void InitializeLibrary()
        {
#if !CORERT
            __vtable_IUnknown.Initialize();
            McgModuleManager.Initialize();
#endif
            RuntimeAugments.InitializeInteropLookups(new Callbacks());
        }
Esempio n. 3
0
        public static void InitializeLibrary()
        {
#if !CORERT
            __vtable_IUnknown.Initialize();
            McgModuleManager.Initialize();
#endif
            RuntimeAugments.InitializeInteropLookups(RuntimeInteropData.Instance);
        }
Esempio n. 4
0
        public static void InitializeLibrary()
        {
#if CORERT
            InteropCallbackManager.Initialize();
#else
            __vtable_IUnknown.Initialize();
            McgModuleManager.Initialize();
#endif
        }
        public override IntPtr GetDelegateMarshallingStub(RuntimeTypeHandle delegateTypeHandle, bool openStaticDelegate)
        {
            McgModuleManager.GetPInvokeDelegateData(delegateTypeHandle, out McgPInvokeDelegateData pinvokeDelegateData);
            IntPtr pStub = openStaticDelegate ? pinvokeDelegateData.ReverseOpenStaticDelegateStub : pinvokeDelegateData.ReverseStub;

            if (pStub == IntPtr.Zero)
            {
                throw new MissingInteropDataException(SR.DelegateMarshalling_MissingInteropData, Type.GetTypeFromHandle(delegateTypeHandle));
            }
            return(pStub);
        }
        public override IntPtr GetForwardDelegateCreationStub(RuntimeTypeHandle delegateTypeHandle)
        {
            McgModuleManager.GetPInvokeDelegateData(delegateTypeHandle, out McgPInvokeDelegateData data);
            IntPtr pStub = data.ForwardDelegateCreationStub;

            if (pStub == IntPtr.Zero)
            {
                throw new MissingInteropDataException(SR.DelegateMarshalling_MissingInteropData, Type.GetTypeFromHandle(delegateTypeHandle));
            }
            return(pStub);
        }
Esempio n. 7
0
        public static void InitializeLibrary()
        {
#if !CORERT
            __vtable_IUnknown.Initialize();
            McgModuleManager.Initialize();
#endif

#if !CORECLR
            /// @TODO: enable this for Mcg on CoreCLR scenario
            RuntimeAugments.InitializeInteropLookups(RuntimeInteropData.Instance);
#endif
        }
        public override bool TryGetStructUnsafeStructSize(RuntimeTypeHandle structureTypeHandle, out int size)
        {
            RuntimeTypeHandle unsafeStructType;

            size = 0;
            if (McgModuleManager.TryGetStructUnsafeStructType(structureTypeHandle, out unsafeStructType))
            {
                size = unsafeStructType.GetValueTypeSize();
                return(true);
            }
            return(false);
        }
 public override bool TryGetStructFieldOffset(RuntimeTypeHandle structureTypeHandle, string fieldName, out bool structExists, out uint offset)
 {
     return(McgModuleManager.TryGetStructFieldOffset(structureTypeHandle, fieldName, out structExists, out offset));
 }
 public override bool TryGetDestroyStructureStub(RuntimeTypeHandle structureTypeHandle, out IntPtr destroyStructureStub, out bool hasInvalidLayout)
 {
     return(McgModuleManager.TryGetDestroyStructureStub(structureTypeHandle, out destroyStructureStub, out hasInvalidLayout));
 }
 public override bool TryGetStructMarshalStub(RuntimeTypeHandle structureTypeHandle, out IntPtr marshalStub)
 {
     return(McgModuleManager.TryGetStructMarshalStub(structureTypeHandle, out marshalStub));
 }
Esempio n. 12
0
 public static void InitializeLibrary()
 {
     __vtable_IUnknown.Initialize();
     McgModuleManager.Initialize();
 }
Esempio n. 13
0
 public override bool TryGetMarshallerDataForDelegate(RuntimeTypeHandle delegateTypeHandle, out McgPInvokeDelegateData data)
 {
     return(McgModuleManager.GetPInvokeDelegateData(delegateTypeHandle, out data));
 }