Tlb2h Usage

Wrapper Generation

The main usage of tlb2h is for generation of wrappers for a type-library.

There are two main sub-usages, "server wrappers" for implementation of a server, and "client wrappers" for when only the client wrappers are required.

When client wrappers (-c) are specified, connection-point wrappers are not generated, but the server wrappers are generated for all interfaces being used as connection-point sinks.

tlb2h [options] {typelibraries}

-c Client wrappers (exclude server wrappers)
-n Include nutshell wrappers
-o {directory} Specify output directory
-r {namespace} Rename library namespace
-F Exclude foreign source implementations
-h[+-] Ouput/suppress html
-H Output only html
-R {translate file} Specify namespace/symbol mapping file
-x {symbol file} Exclude symbols in file
-s[+-] {symbol file} Output only symbols in file. '-s-' to reduce symbols stubs output.

Translation File Format

Use either ';' or '#' at the beginning of the line to specify a comment.

Each translation appears on a separate line in the file separate by '=':

{OriginalSymbol}={RenamedSymbol}

The symbol and namespace renaming does apply to the output filename as well as the namespace and method names (before the Put/Get/PutRef/raw_ are applied).

Symbol File Format

Symbol files are used with -x or -s to reduce the number of wrappers and interfaces output by tlb2h. This is useful where only certain interfaces are required and where some of the interfaces are non-standard, or where only a small subset of the interfaces of a large typelibrary are required.

Presently, only coclasses and interfaces apply to either -x or -s.

By default, any interfaces/coclasses output, will cause any unrequired dependent interfaces to be output in 'stubbed' form. This means that the struct/interface id is present, but vtable fillers are generated for the interface and the wrappers for com_ptr (wrap_t) are empty (with an appropriate comment).

Once again within the file, use either ';' or '#' at the beginning of the line to specify a comment.

Each symbol needs to be on a separate line, optionally prefixed by either '*' or '~'.

'*' before a symbol forces the server wrapper to be output even if -c is specified on the commandline. In '-x' mode, the symbol is output, and the server wrapper generated.

'~' before a symbol means that a symbol is included, but that only a stub is generated for the symbol. This is useful for -s- and where the symbols are referenced by a another typelibrary but are not being used in the code.

Wizard Code Generation

The second usage of tlb2h is 'Wizard' mode, which generates a code stub for either specified or for all coclasses.

The output file is always appended to - the wizard will not overwrite code already present!

tlb2h [-w[+] coclass[{,coclass}] | -W] [-o outputfile] typelibrary

-w[+] coclass[{,coclass}] Specify coclasses to output coclass-stubs for. Use '-w+' to qualify types with namespaces
-W[+] Output all coclasses. '+' to qualify types with namespaces
-Wc Output class names only."
-o {filename} Specify output file. Defaults to stdout.