Using gethostbyname_r instead of gethostbyname in std.socket
MWumpusZ via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 7 01:38:24 PDT 2016
We are currently using phobos from
http://downloads.dlang.org/releases/2016/dmd.2.071.0.linux.zip
Phobos' InternetAddress contained therein uses gethostbyname and
not gethostbyname_r; std.socket imports core.sys.posix.netdb,
which only makes gethostbyname available.
gethostbyname_r would be made available by importing
std.c.linux.socket, but this is marked as deprecated in favour of
core.sys.posix.BLAH
The use of gethostbyname is a problem for us because, even though
std.socket synchronises access to the function, we are using a
third party (non-D) library in our application which also uses
gethostbyname, and of course that library doesn't care about the
synchronisation in std.socket.
Is there a reason why gethostbyname_r isn't usually used?
Even for those environments which don't have it, version(linux)
(or whatever) in core.sys.posix.netdb should be able to deal with
that easily, shouldn't it?
More information about the Digitalmars-d
mailing list