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;
 }

[EMAIL PROTECTED]:~$ 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
[EMAIL PROTECTED]:~$ 

Now make the prototype

void *__stdcall gethostbyname(const char *name);

and:

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

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


_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to