We have created a simple C# class library like this (ClassLibrary1):
[ComVisible(true)]
public struct MyTestStruct
{
public int z;
public int h;
}
[ComVisible(true)]
public interface IMyTestInterface
{
void MyTestFunction();
}
[ComVisible(true)]
public class CMyTestCom : IMyTestInterface
{
public void MyTestFunction()
{
}
}
Export a tlb from it and use:
importlib("ClassLibrary1.tlb"); in an idl file.
The problem is that the intarface type (IMyTestInterface) can be used in the idl, but the struct is not accessable and we do not know why.
So this idl can be compiled:
importlib("stdole2.tlb");
importlib("ClassLibrary1.tlb");
[
object,
uuid(DB25FC11-C288-4B31-BE11-5BBA6B273D9B),
dual,
nonextensible,
pointer_default(unique)
]
interface IMyNativeTestObj : IDispatch
{
[id(1)] HRESULT MyFunction([in] IMyTestInterface *Parameter);
};
And this is not:
importlib("stdole2.tlb"); importlib("ClassLibrary1.tlb");
[
object,
uuid(DB25FC11-C288-4B31-BE11-5BBA6B273D9B),
dual,
nonextensible,
pointer_default(unique)
]
interface IMyNativeTestObj : IDispatch
{
[id(1)] HRESULT MyFunction([in] MyTestStruct *Parameter);
};
we have tried the tagMyTestStruct with the same result. If we open the tlb with the OleView "MyTestStruct" is in it.