Search code examples
c++macrostypelib

Scope of a macro in a library (.tlb) file?


Assume we have a macro 'HELLO' defined in a .cpp file and we have built a .tlb file out of it. When I import this .tlb file in an another c++ project, do I have access to that macro?

By default if a macro is defined in .c file, the scope is within that file. If macro is defined in .h file, then everyone who includes it has access to the macro. Just wondering if the behaviour is same even via .tlb file .../


Solution

  • Type libraries are only storing type information (Interface & class declarations, typedef's, other meta-data), not code. The implementation of the code is defined inside the respective library (DLL) or server (EXE). This mean's type libraries are only telling clients where to find code. They do not provide code. This is why macros cannot be exported to tlb's.