windows api support

1,289 views
Skip to first unread message

Vasiliy Tolstov

unread,
Feb 9, 2012, 5:59:31 AM2/9/12
to golang-nuts
Hello again =).
How can i call windows api functions from go? For example i need to call
SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces,
SetupDiGetDeviceInterfaceDetail ?

is that possible, like in linux use c functions inside go in windows ?


--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru

AllenDang

unread,
Feb 9, 2012, 6:11:54 AM2/9/12
to golang-nuts
Check https://github.com/AllenDang/w32, it's a windows API wrapper.

On Feb 9, 6:59 pm, Vasiliy Tolstov <v.tols...@selfip.ru> wrote:
> Hello again =).
> How can i call windows api functions from go? For example i need to call
> SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces,
> SetupDiGetDeviceInterfaceDetail ?
>
> is that possible, like in linux use c functions inside go in windows ?
>
> --
> Vasiliy Tolstov,
> Clodo.ru
> e-mail: v.tols...@selfip.ru
> jabber: v...@selfip.ru

Vasiliy Tolstov

unread,
Feb 9, 2012, 6:17:35 AM2/9/12
to AllenDang, golang-nuts
2012/2/9 AllenDang <alle...@gmail.com>:

> Check https://github.com/AllenDang/w32, it's a windows API wrapper.
>

Thanks! But i see, that my functions not implemented (or i'm wrong?)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff551069(v=vs.85).aspx
says, that i need Setupapi.lib, but i can't find it in LoadLib in
sources, that You provide...


--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru

AllenDang

unread,
Feb 9, 2012, 7:15:59 AM2/9/12
to golang-nuts
It's very easy to wrap the windows API you need by following what w32
did.

On Feb 9, 7:17 pm, Vasiliy Tolstov <v.tols...@selfip.ru> wrote:
> 2012/2/9 AllenDang <allen...@gmail.com>:
>
> > Checkhttps://github.com/AllenDang/w32, it's a windows API wrapper.
>
> Thanks! But i see, that my functions not implemented (or i'm wrong?)http://msdn.microsoft.com/en-us/library/windows/hardware/ff551069(v=v...
> says, that i need Setupapi.lib, but i can't find it in LoadLib in
> sources, that You provide...
>
> --
> Vasiliy Tolstov,
> Clodo.ru
> e-mail: v.tols...@selfip.ru
> jabber: v...@selfip.ru

Vasiliy Tolstov

unread,
Feb 9, 2012, 7:21:02 AM2/9/12
to AllenDang, golang-nuts
2012/2/9 AllenDang <alle...@gmail.com>:

> It's very easy to wrap the windows API you need by following what w32
> did.
>
Ohh Thanks! Now i'm understand - i need to clone repo, create need dir
and create my code like in kernel32 =).

--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru

Benny Siegert

unread,
Feb 9, 2012, 10:11:59 AM2/9/12
to Vasiliy Tolstov, AllenDang, golang-nuts
On Thu, Feb 9, 2012 at 13:21, Vasiliy Tolstov <v.to...@selfip.ru> wrote:
> 2012/2/9 AllenDang <alle...@gmail.com>:
>> It's very easy to wrap the windows API you need by following what w32
>> did.
>>
> Ohh Thanks! Now i'm understand - i need to clone repo, create need dir
> and create my code like in kernel32 =).

You could even do a pull request to have your code added to w32 ;).

--Benny.


--
The first essential in chemistry is that you should perform practical
work and conduct experiments, for he who performs not practical work
nor makes experiments will never attain the least degree of mastery.
        -- Abu Musa Jabir ibn Hayyan (721-815)

Vasiliy Tolstov

unread,
Feb 9, 2012, 1:09:48 PM2/9/12
to Benny Siegert, AllenDang, golang-nuts
2012/2/9 Benny Siegert <bsie...@gmail.com>:

> On Thu, Feb 9, 2012 at 13:21, Vasiliy Tolstov <v.to...@selfip.ru> wrote:
>> 2012/2/9 AllenDang <alle...@gmail.com>:
>>> It's very easy to wrap the windows API you need by following what w32
>>> did.
>>>
>> Ohh Thanks! Now i'm understand - i need to clone repo, create need dir
>> and create my code like in kernel32 =).
>
> You could even do a pull request to have your code added to w32 ;).
>
> --Benny.
>

Yes after i create some code i create pull request. I'm interesting to
create more functional windows api go support (i'm use go to control
xen hvm vps running windows 2008)

Reply all
Reply to author
Forward
0 new messages