Let's assume
- I'm working for company A and I provide a C# DLL called
managed.dllwhich is COM visible. I provide as well the TLB file calledmanaged.tlb.- a company B is using my
managed.dllin a C++ EXE calledunmanaged.exe.- a customer C has to get the
managed.dllfrom my company A and theunmanaged.exefrom company B. The reason for that is that company B is not allowed to redistribute themanaged.dllfrom company A.
Now let's assume I add a method or property to one of my classes in my managed.dll. Then the unmanaged.exe from company B is broken. Company B has to recompile it with the newer tlb-file.
How can I avoid that company B has to recompile their unmanaged.exe when I add something to my managed.dll?
The reason why I'm asking is
- I've no control when company B is recompiling or releasing their
unmanaged.exe. Even if I provide mymanaged.dllto company B every time I've added something.- I've no control which versions of the
managed.dllandunmanaged.exethe customer C is using.- company B would like to claim that their
unmanaged.exeV1.0 is working with mymanaged.dllV1.0 or newer.
How can we achieve that?
The source code of my managed.dll looks like that:
[Guid("852e5991-ddcc-56dd-8e13-90dcaf11ebe5")]
[ComVisible(true)]
public interface ITestA
{
string DummyString();
int DummyInt();
}
[Guid("41916928-6bea-43de-bedb-318df340e7b8")]
[ComVisible(true)]
[ComDefaultInterface(typeof(ITestA))]
public class TestA : ITestA
{
public string DummyString() { return "Dummy"; }
public int DummyInt() { return 123; }
}
The tlb-file is generated with RegAsm.exe managed.dll /tlb /codebase.
The source code of the unmanaged.exe looks like that:
#include "stdafx.h"
#import "managed.tlb"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = CoInitialize(NULL); // Init COM
IClassAPtr pClassA(__uuidof(ClassA));
// and so on ...
}
Regards Wollmich