0

I am trying to create COM wrapper class for a COM library. I first used MIDL to compile the .IDL into .TLB, then used TlbImp to generate a managed wrapper assembly. However, I found some of the interfaces are not included in the managed wrapper, the reason is they are not mentioned in the 'library' section.

Is there any way to let the final managed wrapper assembly include all the interfaces instead of changing the .IDL and manually writing all interfaces inside 'library'?

Adam B
  • 3,775
  • 3
  • 32
  • 42
codewarrior
  • 723
  • 7
  • 22
  • Can you provide more detail regarding what kind of interfaces are missing, normally tlbimp does a good job while creating RCW – Mrinal Kamboj Jul 02 '15 at 18:43
  • @MrinalKamboj Thanks for your replying. This is an internal COM library so I cannot share its .IDL directly. Basically, there are some interfaces defined in IDL but those interfaces are missing from the 'library' section. TlbImp seems only generate wrappers for those interfaces & coclasses mentioned inside 'library', that is my problem. – codewarrior Jul 02 '15 at 18:53
  • That is correct. For such interfaces, you'll have to declare them manually. And some advanced MIDL declarations, such as `[out, size_is(, *pSize)]`, will require custom marshaling. – acelent Jul 03 '15 at 09:27
  • 2
    Interfaces that are not defined nor referenced in the `library` block do not make it into the TLB file in the first place. Since they are not in the TLB, TlbImp never sees them, and can't possibly generate wrappers for them. – Igor Tandetnik Jul 04 '15 at 01:09

0 Answers0