I have a C++ project and a c# project. The C# project accesses methods of the C++ project through 2 interop dlls called interop.X.dll and interop.XCom.dll.
When my C++ project rebuilds it creates X.tlb and XCom.tlb files, it also creates x_i.c, x_h.h, xCom_i.c, xCom_h.c files. I have found that the files are created due to project settings in "configuration properties -> MIDL -> output", as displayed below;
What I need to know is how to create the 2 interop dlls, which doesn't get created automatically, using the .tlb and other c files. I have tried using tlbimp x.tlb /out:Interop.x.dll
, but the created dll doesn't seem to work.
Thanks.
This is a summary of my comments above.
Why not just bypass tlb references and instead just add a direct COM reference?
Adding a COM reference from .NET to your COM library requires zero change on the COM project. VS creates the interop dlls when you add a COM reference from your .NET project