Working with COM interfaces in Go

480 views
Skip to first unread message

Lubos Pintes

unread,
Aug 23, 2013, 10:33:11 AM8/23/13
to golan...@googlegroups.com
Hi,
I need to work with COM a bit. Either use or implement some COM interfaces.
Any tips about how to do this are welcomed. I am new to Go. So if there
is something obvious, I am not aware of that.
Thanks

Konstantin Khomoutov

unread,
Aug 23, 2013, 10:55:34 AM8/23/13
to Lubos Pintes, golan...@googlegroups.com
Take a look at https://github.com/mattn/go-ole/

I'm not sure it allows you to implement a COM object but it appears
that it makes it possible to instantiate and call them (see the
"example" directory).

Andy Balholm

unread,
Aug 23, 2013, 3:02:42 PM8/23/13
to golan...@googlegroups.com, Lubos Pintes
I've made a COM library for my own use. I think it's easier to use than mattn/go-ole. Since you asked, I put it on Google Code: code.google.com/p/com-and-go

atomly

unread,
Aug 23, 2013, 3:20:54 PM8/23/13
to golang-nuts, Lubos Pintes, Andy Balholm
On Fri, Aug 23, 2013 at 3:02 PM, Andy Balholm <andyb...@gmail.com> wrote:
I've made a COM library for my own use. I think it's easier to use than mattn/go-ole. Since you asked, I put it on Google Code: code.google.com/p/com-and-go


Ha! I nominate this one of the best pun names so far in goland...

:: atomly ::

[ ato...@atomly.com : www.atomly.com  : http://blog.atomly.com/ ...
[ atomiq records : new york city : +1.347.692.8661 ...
[ e-mail atomly-new...@atomly.com for atomly info and updates ...

Lubos Pintes

unread,
Aug 24, 2013, 3:33:10 AM8/24/13
to golan...@googlegroups.com
Hello,
I noticed that IUnknown and IDispatch interfaces in your library are
commented. Is this something special, or simply comment?
Thanks
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
> golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.


Lubos Pintes

unread,
Aug 24, 2013, 4:54:48 AM8/24/13
to golan...@googlegroups.com
... Just discovered, some portions are autogenerated.
This is very unusual to me, so was not immediately obvious.

Andy Balholm

unread,
Aug 24, 2013, 2:13:22 PM8/24/13
to golan...@googlegroups.com, lubos....@gmail.com
On Saturday, August 24, 2013 1:54:48 AM UTC-7, Lubos Pintes wrote:
... Just discovered, some portions are autogenerated.
This is very unusual to me, so was not immediately obvious.

Using commented code to autogenerate the actual code is a pattern I copied from the mksyscall script in the standard library source. 

You can do the same in your own code, and run mkcomcall on it, if you want to avoid the overhead of IDispatch. But mkcomcall can't handle method parameters that are larger than uintptr—like VARIANT. 

Andy Balholm

unread,
Sep 10, 2013, 2:51:53 PM9/10/13
to golan...@googlegroups.com, lubos....@gmail.com
On Saturday, August 24, 2013 11:13:22 AM UTC-7, Andy Balholm wrote:
You can do the same in your own code, and run mkcomcall on it, if you want to avoid the overhead of IDispatch. But mkcomcall can't handle method parameters that are larger than uintptr—like VARIANT. 

Update: mkcomcall can handle large parameters, including VARIANT, now. 
Reply all
Reply to author
Forward
0 new messages