bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getaddrinfo: finding gethostbyname in mingw32


From: Simon Josefsson
Subject: getaddrinfo: finding gethostbyname in mingw32
Date: Wed, 18 Jan 2006 11:24:00 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Hi!

After fixing socklen and sys_socket, I'm now back at trying to get
getaddrinfo to work under mingw32.  My problem is getting
AC_SEARCH_LIBS to find functions in the mingw32 libraries.  It seems a
__stdcall is required in the prototype to make it link correctly.
See:

void * gethostbyname(const char *name);

int main () {
  char *p;

  p = gethostbyname ("tnw.extundo.com");
  printf ("%x\n", p);
  p = gethostbyname ("fofo.extundo.com");
  printf ("%x\n", p);

  return 0;
 }

address@hidden:~$ i586-mingw32msvc-gcc -o bar.exe bar.c -lwsock32
/tmp/cc6uDKL2.o:bar.c:(.text+0x33): undefined reference to `_gethostbyname'
/tmp/cc6uDKL2.o:bar.c:(.text+0x59): undefined reference to `_gethostbyname'
collect2: ld returned 1 exit status
address@hidden:~$ 

Now make the prototype

void *__stdcall gethostbyname(const char *name);

and:

address@hidden:~$ i586-mingw32msvc-gcc  -o bar.exe bar.c 
/tmp/cckpKYIg.o:bar.c:(.text+0x33): undefined reference to address@hidden'
/tmp/cckpKYIg.o:bar.c:(.text+0x59): undefined reference to address@hidden'
collect2: ld returned 1 exit status
address@hidden:~$ i586-mingw32msvc-gcc  -o bar.exe bar.c -lwsock32
address@hidden:~$ 

Does anyone see any way to make this work?  It seems I would need to
add a prototype for the linker test.  Of course, it should try it
without the prototype first, so it behaves on normal systems.

I experimented with the -mrtd gcc flag, but it didn't seem to do
anything.

Thanks,
Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]