o
odinpkg.dev
packages / binding / COM-API-Codegen

COM-API-Codegen

f91518abinding

Generate COM bindings via .tlb files

No license · updated 6 months ago

COM to Odin Code Generator

Generates Odin bindings from Windows COM type libraries and IDL files.

Usage

com_codegen <input> <package_name>

Inputs:

  • .tlb - COM Type Library (Windows only)
  • .idl - Interface Definition Language (cross-platform)
  • Directory of .tlb files (Windows only)

Examples:

com_codegen mylib.tlb excel
com_codegen audioclient.idl wasapi
com_codegen C:\Windows\System32 stdole

Output

Generates an Odin package containing:

  • com_base.odin - COM types and helpers
  • forward_decls.odin - Interface forward declarations
  • Per-library .odin files with interfaces, enums, structs

Features

  • Interface vtables with wrapper methods
  • BSTR/VARIANT_BOOL converted to string/bool
  • [out, retval] params as return values
  • Optional parameter overloads
  • Coclass factories (_create, _get_active)
  • Event sink generation
  • Module DLL imports
  • IDL #define constants from cpp_quote

Building

odin build .

TLB parsing requires Windows. IDL parsing works on any platform.