Skip to content

Latest commit

 

History

History
112 lines (83 loc) · 5.82 KB

ChangeLog.md

File metadata and controls

112 lines (83 loc) · 5.82 KB

Version x.x.x

COM Generate Tool

The COM generate tool is new to version 0.2 and allows for generating Go code based off of COM type library information. This is used within the COM library to generate code to reduce the time it takes to implement a COM interface and keep the code uniform throughout.

Version 0.2

  • Requires Go 1.5. Technically, can be used in 1.4, but won't prevent access to internal packages.
  • Use internal packages to separate build environments and keep root directory clean.
  • Move error to its own package. This should remove cyclic dependencies.

Safe Array

Safe array was moved out in 0.1, but was moved back in version 0.2 to take advantage of internal packages.

Changes from go-ole

  • No SafeArrayConversion object. These have been moved to Array object.

  • SafeArray object has been renamed to COMArray.

  • All SafeArray*() functions are public and have been renamed.

    "SafeArray" has been removed from the function names and the names have been expanded to play better with Go naming standards.

Features

  • CGO is supported. (Still in development. Not tested)

  • All SafeArray functions are available and implemented. (IRecordInfo is not available by default)

  • Conversion for Byte array and String arrays exist.

  • Array object provides helper methods for all available SafeArray functions.

  • Array object provides method for retrieving total number of elements in all dimensions.

  • Array object provides method for appending SafeArray elements to existing Go slice of any type.

  • Array object provides automatically returning Go slice based on SafeArray variant type.

  • Provides helper for creating COM SafeArray from any Go slice.

  • All known types are supported and will append to existing type.

    This is done using reflection. The purpose is to allow for any type of Go slice or array to work with SafeArrays and not have to worry too much about creating specific functions for each type to add support.

    The only difference, is that strings and other types may require manual cleanup, but user defined types do not have this problem.

  • UnmarshalArray() exists as a single point of creating a COM SafeArray object.

  • MarshalArray() exists as a single point to convert COM SafeArray object to Go slice.

  • Multidimensional COM SafeArray are supported.

In Progress

  • Fully documented.
  • Fully tested.
  • Supports Go multidimensional slices.

Version 0.1

** This version is unreleased. **

  • Requires Go 1.4.
  • Move files to separate directories.
  • Add empty cgo directory for future development. Only has note.
  • More constants added.
  • Change variables and constants to match Go naming idioms.
  • Create COM Generate readme.md to describe command line tool.
  • COM Interfaces have been moved to their own packages.
  • oleutil was removed. It is now part of the api library.
  • connect was removed. It is now part of the COM generate tool.
  • Interface packages can be served by COM.

Interface Packages

Each COM interface has its own package. The package is split into files that should be autogenerated and files that need to be manually edited.

Each package is standardize with the following components.

  • VirtualTable for references (pointers) to object methods.
  • Optional InterfaceID GUID variable that references the IID for the COM interface.
  • Structure type based on iunknown.Unknown that has a reference to the object virtual table.
  • Interface type that defines the type methods for the COM interface for Go.
  • VTable() type method that returns the VirtualTable.
  • Type methods that implements the COM Go interface type for structure based on iunknown.Unknown. These type methods use the client methods of the package or other packages.
  • Doc.go that provides a simple guide to using the package interface.
  • COM client methods (client.go) that may need to be manually implemented. The methods names and parameters are auto generated, but will need to be implemented.
  • COM client tests and examples in client_test.go.
  • COM server methods (server.go) that may need to be manually implemented. The methods names and parameters are auto generated, but will need to be implemented.
  • COM server tests and examples in server_test.go.
  • VirtualTableService() function that returns references to COM server *Service() functions. This can be auto generated.
  • IInterfaceService() function that returns COM server reference object for IUnknown or another COM Interface object.

Backwards Incompatible Changes

  • CoInitialize() accepts no parameters.
  • CoInitializeEx() accepts one parameter; the parameter is the currency type.
  • VT is now VariantType.
  • CLSIDFromProgID() is now ClassIDFromProgramID().
  • CLSIDFromString() is now ClassIDFromString().
  • CreateInstance() is now CoCreateInstance().
  • Many of the constants have been renamed and are typed. You will need to convert before using in places where the native value would have been acceptable.

COM Interface Casting

Version 0.1.x casted directly to IUnknown and IDispatch in some places. These were really, the only interfaces that were supported by the library. The changes to the API allows for casting to any known COM interace, but the parameter changes removes backwards compatibility with previous version.

This is what you would use in version 0.1.x:

clsid, _ = CLSIDFromProgID("...")
unknown, _ := CreateInstance(clsid, IID_IUnknown)

This changes in version 0.2.x and you must have the correct IID along with the structure. The name of the function has also changed.

clsid, _ = ClassIDFromProgramID("...")
var unknown IUnknown
CreateInstance(clsid, IID_IUnknown, &unknown) // Ignore error.

This change allows for supporting custom COM interfaces and other default COM interfaces without directly supporting them in the code.