Skip to content
Jacob Santos edited this page Oct 4, 2022 · 1 revision

COM API Generator

Background

A lot of the go-ole library usage is boilerplate. There are helpers that attempt to minimize how much effort the user needs to code.

Purpose

This code generation tool produces code that uses the go-ole library to produce a local go file that can be used instead of either calling directly to the go-ole library or manually creating a bridge or adapter.

History

The initial effort was to use the OLE libraries to pull the COM/OLE definitions and generate the interop code that bridges the go-ole library with Go. Generate the code for the user so that they don't have to worry about manually using the library at all.

This was abandoned because it was really a feature of .NET and only some COM provided the means for discovering the definitions. Meaning it would work great for when those definitions were provided. Similar to WSDL generators for SOAP.

Proposal

Follow the standard established by other Go code generators where the definitions are defined in comments. Generate the Go code based on the comments.

  • The generator should work with all versions of the library.
  • The generator should work with structures defined by the user.
  • The generator should work with functions defined by the user (in comments).

Code Generator Definition

Objects

We should move to marshaling and unmarshaling semantics for COM/OLE in the future. Everything should be objects in the future.

  • We should follow the JSON comments to populate the properties.
  • We should have an interface for populating the properties or overriding the default reflection behavior.

Functions

For backward compatibility, we need to create functions that users will be used to so that they can start moving towards the generator.