简体   繁体   English

.NET Compact COM互操作性

[英].NET Compact COM interoperability

I have the following code in a full .NET framework solution: 我在完整的.NET Framework解决方案中具有以下代码:


public delegate int CreateObjectDelegate(
            [In] ref Guid classID,
            [In] ref Guid interfaceID,
            [MarshalAs(UnmanagedType.Interface)] out object outObject);

...

var createObject = (NativeMethods.CreateObjectDelegate)
    Marshal.GetDelegateForFunctionPointer(
        NativeMethods.GetProcAddress(_modulePtr, "CreateObject"),
            typeof (NativeMethods.CreateObjectDelegate));
object result;
Guid interfaceId = _guid;
Guid classID = _classId;
createObject(ref classID, ref interfaceId, out result);

The purpose is to create the needed COM object at runtime. 目的是在运行时创建所需的COM对象。 Is it possible with any .NET compact framework? .NET Compact Framework是否有可能?

Note that it doesn't have Marshal.GetDelegateForFunctionPointer. 请注意,它没有Marshal.GetDelegateForFunctionPointer。

For whatever (absolutely stupid) reason, the CF doesn't include Marshal.GetDelegateForFunctionPointer. 出于任何(绝对愚蠢)原因,CF均不包含Marshal.GetDelegateForFunctionPointer。 I've been asking the team for it for years. 我多年来一直在向团队询问。 There's simply no way to take a function pointer and call it in the CF. 根本没有办法获取函数指针并在CF中调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM