Reputation: 4903
I have some legacy C++ code.
I have DLL Bob. I also have program Jane.
Program Jane imports Bob through his TLB file.
#import 'Bob.tlb'
Why does Jane use Bob like that?
Why doesn't Jane use Bob like this?
#import 'Bob.dll'
I have the source code for both sides. Thanks for any help or pointers!
Upvotes: 5
Views: 5450
Reputation: 280
TLB is type definition, which also can includes in DLL. If you directly use #import *.tlb or #import *.dll, the MIDL Compiler would generate .tlh and .thi which used in following compiling steps.
It's not a good choice to directly #import. If you #import the same .tlb in different cpp in same project, would introduce duplication .tlh & .tli files generated.
Upvotes: 1
Reputation: 14591
#import
ing a dll is equivalent to importing a tlb only when the dll contains the type library as the resource of ITypeLib
type, as dictated by LoadTypeLib
API call.
This is not always the case:
tlbexp
toolUpvotes: 5