Calling unmanaged C++ COM Objects from C#
I was reading this MSDN article which deals with creating a .NET managed wrapper around a COM object. They mention two approaches, either to auto-generate the wrapper using tlbimp, or manually to create a C# interface and dummy class.
But what about in our case where we have an ODL file containing a COM Interface declaration (we don't use any type libraries), which on the C++ side is compiled by the IDL compiler? Is there no way the ODL file can be used dir开发者_Python百科ectly by .NET? Or in this case do we still have to use one of the approaches mentioned in the article?
I don't think you'll be able to use the ODL file directly: you can generate a type library from an ODL file and then give that type library to tlbimp.exe.
精彩评论