我想知道如何将字符串类型编组为BSTR *类型 . 只是详细说明,C结构如下:
struct MyStruct
{
BSTR* string;
int a;
}
我需要在C#方面定义一个新的sturct,我尝试了string []和IntPtr []但是没有取得成功 .
谢谢你的帮助!
编辑:c结构:
struct HTTPTEXTRENDERERFILTERINFO {
enum { UTC, GMT } eTimestamp;
BOOL bEnableCCIngest;
LONG lQueueSizeTreshold;
LONG lSendTimeTreshold;
BYTE btBroadcastUrlCount;
BSTR* pbstrBroadcastUrls;
LONG lInputPinsNum;
};
和函数的原型:
HRESULT HTTPTextRendererFilter::SetConfig(IN const HTTPTEXTRENDERERFILTERINFO& Config)
c#结构:
[StructLayout(LayoutKind.Sequential,CharSet = CharSet.Unicode)] public struct HttpTextRenderFilterInfo {public enum TimestampType:int {UTC,GMT}; public TimestampType时间戳;
public int EnableCCIngest;
public int QueueSizeTreshold;
public int SendTimeTreshold;
public byte BroadcastUrlCount;
[的MarshalAs(UnmanagedType.BStr)]
public string pbstrBroadcastUrls;
public int lInputPinsNum;
};
原型:
[PreserveSig]
int SetConfig([In] ref HttpTextRenderFilterInfo config);
1 回答
试试这个: