Calling COM code from Go

How to call COM code from Go

In my previous blog I talked about how to call to C functions directly using syscall module, without using Cgo. We can expand this idea a bit further - to call COM objects in Go. As a simple example, let’s see if we can call IMalloc interface implemented in Windows.

Calling C functions from GO

How to call C functions from GO

I’ve recently started learning GO and given that I’ve spent majority of my career in interop between runtimes and languages, I’m naturally curious on how you can interop between GO and other languages. It is most important to have the two functionality below:

  • retrieve a native function pointer
  • call the native function pointer with arguments and receive values back