[Win32utils-devel] if_indextoname on Windows?

Daniel Berger djberg96 at gmail.com
Thu Aug 13 12:20:31 EDT 2009


Hi,

<snip>

> Here is my result:
>
> First, you must build ruby with --with-winsock2 option.

Oh, Ruby itself has to be rebuilt? Oof. I'm actually curious why
winsock2.h isn't the default. I vaguely recall this coming up at some
point before but I've forgotten why now.

> Second, WIN32_LEAN_AND_MEAN macro must not used.

That means modifying the source, right? Or is there a way to undef it
from extconf.rb?

> C:\>irb
> irb(main):001:0> require 'mkmf'
> => true
> irb(main):002:0> COMMON_HEADERS.replace("#include <winsock2.h>")
> => "#include <winsock2.h>"
> irb(main):003:0> have_header('netioapi.h')
> checking for netioapi.h... yes
> => true
> irb(main):004:0> have_func('if_indextoname', 'netioapi.h')
> checking for if_indextoname() in netioapi.h... no
> => false
> irb(main):005:0> have_func('if_indextoname', 'iphlpapi.h')
> checking for if_indextoname() in iphlpapi.h... no
> => false
> irb(main):006:0> have_library('iphlpapi', 'if_indextoname', 'netioapi.h')
> checking for if_indextoname() in iphlpapi.lib... yes
> => true
> irb(main):007:0> have_func('if_indextoname', 'netioapi.h')
> checking for if_indextoname() in netioapi.h... yes
> => true
> irb(main):008:0> have_func('if_nametoindex','netioapi.h')
> checking for if_nametoindex() in netioapi.h... yes
> => true
> irb(main):009:0> have_library('iphlpapi', 'if_nametoindex', 'netioapi.h')
> checking for if_nametoindex() in iphlpapi.lib... yes
> => true

Excellent, thank you.

Regards,

Dan


More information about the win32utils-devel mailing list