Mapping Symbol Names in a Type Library
Go Up to TLIBIMP.EXE
When importing type libraries, custom mapping for some type libraries is specified in the tlibimp.sym file. Current mapping might differ from code generation in previous releases.
In previous releases, when new type libraries were added using an existing identifier, an underscore was added to distinguish the identifier. So, the identifier called Application became Application_. Additional underscores might be added if another imported type library used the same identifier.
C++Builder enables you to map symbol names in the type library within the tlibimp.sym file, located in the \BIN directory. The tlibimp.sym file contains mapping for some common applications including Microsoft Word, Microsoft Excel, Microsoft PowerPoint, and Microsoft Access. For example, when doing Microsoft Word automation, the symbol that used to be Application_ is now WordApplication.
TLIBIMP.SYM Example
The following example shows how symbol names are remapped for Microsoft Word. The first line (after the comment) specifies the GUID (globally unique identifier) of the server in the registry:
[{00020905-0000-0000-C000-000000000046}:TypeNames]
The rest of the lines remap keys to new values (instead of just adding an underscore to conflicting identifiers):
;;==============================================;; ;; Map WinWord CoClasses to better names ;; ;;==============================================;; [{00020905-0000-0000-C000-000000000046}:TypeNames] Application=WordApplication Document=WordDocument Font=WordFont ParagraphFormat=WordParagraphFormat OLEControl=WordOLEControl LetterContent=WordLetterContent Global=WordGlobal Selection=WordSelection Range=WordRange
You can edit the tlibimp.sym file in order to map conflicting symbols for other servers whose type libraries you want to import. Use the same format as shown for the example above.
Caution: Be careful when editing tlibimp.sym. Do not change any remapping that occurs for C++ or Pascal member or type names at the beginning of the file.