Mail Archives: cygwin/2000/11/29/08:34:10
> Hello everybody,
>
> I am trying to compile and link a small program with the cygwin
> g++ compiler that I successfully compiled and linked with
> MS Dev Studio, but with success so far.
>
> The program calls a DLL function that is provided from another
> application that returns a socket descriptor s. When calling
> select() to wait for data sent by the application, the program
> compiled and linked with cygwin always returns with an error
> because the select() call returns (-1) and errno contains
> 9 (EBADF, Error bad file descriptor). The same app works
> fine when compiled and linked with MS Dev Studio so I
> assume that it has to do with the way ti is linked with
> the libraries for socket comm. ( wsock32.lib/wsock32.dll).
>
>
> I tried linking in several ways, first using the lib in
> /usr/lib/libwsock32.a:
>
> The result which does not work is linked with the following
> libs (output from objdump):
>
> -----------------------------------------------------
> There is an import table in .idata at 0x41b000
>
> The Import Tables (interpreted .idata section contents)
> vma: Hint Time Forward DLL First
> Table Stamp Chain Name Thunk
> 0001b000 0001b07c 00000000 00000000 0001b4f8 0001b154
>
> DLL Name: cygwin1.dll
> vma: Hint/Ord Member-Name
> 1b228 6 __errno
> 1b234 23 __infinity
> 1b244 24 __main
> 1b250 91 _ctype_
> 1b25c 497 abort
> 1b264 527 atexit
> 1b270 539 calloc
> 1b27c 555 close
> 1b284 593 cygwin_internal
> 1b298 610 dll_crt0__FP11per_process
> 1b2b4 637 exit
> 1b2bc 647 fclose
> 1b2c8 655 fflush
> 1b2d4 660 fileno
> 1b2e0 674 fread
> 1b2e8 675 free
> 1b2f0 680 fseek
> 1b2f8 682 fstat
> 1b300 688 fwrite
> 1b30c 694 getc
> 1b314 765 isatty
> 1b320 810 lseek
> 1b328 812 malloc
> 1b334 818 memchr
> 1b340 820 memcpy
> 1b34c 821 memmove
> 1b358 842 open
> 1b360 848 perror
> 1b36c 854 printf
> 1b378 889 read
> 1b380 893 realloc
> 1b38c 969 signal
> 1b398 993 sprintf
> 1b3a4 1004 strcmp
> 1b3b0 1006 strcpy
> 1b3bc 1026 strtol
> 1b3c8 1028 strtoul
> 1b3d4 1089 write
> The Import Address Table is identical
>
> 0001b014 0001b11c 00000000 00000000 0001b50c 0001b1f4
>
> DLL Name: KERNEL32.dll
> vma: Hint/Ord Member-Name
> 1b3dc 290 GetModuleHandleA
> 1b3f0 644 Sleep
> The Import Address Table is identical
>
> 0001b028 0001b12c 00000000 00000000 0001b520 0001b204
>
> DLL Name: WSOCK32.DLL
> vma: Hint/Ord Member-Name
> 1b3f8 66 select
> The Import Address Table is identical
>
> 0001b03c 0001b134 00000000 00000000 0001b404 0001b20c
>
>
> ......
> -----------------------------------------------------
>
> I also tried copying the library file wsock32.lib from the Dev Stdio CD
> to the working directory and linking
>
> sample.exe: sample.o
> g++ -g -o sample.exe sample.o -L. -lwsock32 -LC:/APP/lib -lAPP
>
>
> but the same result.
>
> I also noticed, that when using the MS Dev Studio exe,
> I always get 132 as File descriptor and this works , but
> with the cygwin linked version I get always 212 as FD, and
> this always returns the (-1) for the select ().
>
>
> Is there anyone out there who can help me on this, I am
> trying to find out whats wrong here for quite a time ...
>
> Tschau
>
>
> Stefan
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -