This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: URGENT HELP: How does a cygwin.dll by passes ws2_32.dll?


> -----Original Message-----
> From: cygwin-owner On Behalf Of Nagamani Veerappa
> Sent: 16 November 2004 06:31

> Dear experts,
> 
> I wonder how can a exe compiled using gcc on cygwin by passes 
> ws2_32.dll?
> 
> Basically I have a windows program compiled using MSVC, need 
> to use socket
> interfaces provided by cygwin...
> I tried linking cygwin1.dll with MSVC, with the great help of 
> ALastair, who
> had written tips (in this forum) to achieve that.

  Just because you've successfully linked two incompatible object files together
doesn't mean that what you have is valid code.  The symbols may match up but
nothing guarantees the data structures, ABI, functionality, or anything else
actually match up.

> But it seems cygwin1.lib/cygwin1.dll doesnot seems to expose socket
> interfaces..

" nm /bin/cygwin1.dll | grep sock " says you're wrong: here are just some of the
symbols it finds

610d7128 T _closesocket@4
610d7298 T _getsockname@12
610d72b8 T _getsockopt@20
610d7340 T _ioctlsocket@12
610d7480 T _setsockopt@20
610d74c0 T _socket@12
6104a6b0 T _socketpair

..etc etc.  That looks a lot like it's "exposing socket interfaces" to me.

> If I link with ws2_32.lib it links with ws2_32.dll ..
> Which I don't want...

  So, let me get you clear:  you're saying that if you link with ws2_32, it gets
linked to ws2_32, and you don't want that?  Well just don't do that then!

> So please help, by answering how can I bypass ws2_32.dll?

  Simple.  Just spend the next ten years writing your own POSIX compatibility
dll that uses microsoft's runtime.  It won't be open source, of course, because
microsoft's runtime libraries aren't, but it will do what you want.

  Look.  Either write a win32 program using MSVC, which is the compiler for
writing win32 programs, (or indeed using gcc -mno-cygwin, which means you can't
use cygwin functions), or write a POSIX program using gcc and cygwin library.

  Your question is a bit like saying "I use a tape recorder to make tape
recordings and a camera to take photographs.  How can I use my tape recorder to
take photos?"

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]