6

By the "traditional" way I mean registering the DLL in registry.

There seems to be another method to set up it by going to mmc->Component Services->COM+ Applications and adding the .tlb file.

I have a COM library that supports both methods. When it installs, it registers itself in the registry as a COM component and it works fine. However, when I added the .tlb file using the Component Services method, the behavior seems to be different and it starts giving out errors.

I suspect it has something to do with marshaling and inter-process object transfer? (Sorry, I'm really a noob in the COM area)

Can anyone point me to a good resource to clear my understanding?

kizzx2
  • 18,775
  • 14
  • 76
  • 83
  • I have a method `X.Method()` that accepts another type `X`, which means something like `void Method(X another)`. Running this method gives me "Cannot convert System.__ComObject to X" – kizzx2 Jun 02 '10 at 05:50

2 Answers2

12

COM+ (Component Services) provides a lot of infrastructure out of the box; for instance COM+ provides transaction, security, object pooling and some other services.

When you register a COM component under COM+ it will run "Out Of Process"; in this mode you are guaranteed to have a proxy between your COM server and its clients.

The best place I can think of for learning more about COM+ is the official MS site: http://msdn.microsoft.com/en-us/library/ms685978(VS.85).aspx

TylerH
  • 20,799
  • 66
  • 75
  • 101
Vagaus
  • 4,174
  • 20
  • 31
  • 2
    Whether the COM component will be out-proc depends on how you register it. It will be out-proc if you select "server application", but it will be in-proc if you select "library application". – sharptooth Jun 02 '10 at 05:26
  • So if I create it in-proc, isn't i the same as registering it the registry and then calling `CoCreateInstance`? – kizzx2 Jun 02 '10 at 05:45
  • 1
    You use CoCreateInstance() anyway. It's just that COM+ intercepts the call and creates on out-proc server. I don't get COM+ library applications - even have a question http://stackoverflow.com/questions/1762823/whats-the-purpose-of-com-library-applications – sharptooth Jun 02 '10 at 06:10
  • @sharptooth: indeed, COM+ applications can run "In Process" also, but, AFAIK, they have limitations (which services are available) – Vagaus Jun 02 '10 at 12:10
3

Agree with the previous post.

One thing to add: actually registering the type library (.tlb file) is normal for COM as well, not only for COM+. The type library is generated automatically by IDL compiler. It contains a description of your interfaces and objects.

So that you can "import" your COM component into some project, and the definition of the interfaces and objects are visible.

Randy Levy
  • 22,566
  • 4
  • 68
  • 94
valdo
  • 12,632
  • 2
  • 37
  • 67