X-Spam-Check-By: sourceware.org
Message-ID: <507150040705081919i1cbf7194y9672fc6a1b1601a2@mail.gmail.com>
Date: Tue, 8 May 2007 19:19:07 -0700
From: "kalasad mailu" <kalasadmailu@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Please Help!! Calling Socket function in a dll file (that is created using cygwin library), by a Microsoft Visual C++ program resulting in infinite loop
In-Reply-To: <463909F9.6B33B9C7@dessent.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <507150040705021415r750600a6oc6e24b339bf57143@mail.gmail.com> 	 <463909F9.6B33B9C7@dessent.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Thanks for your answer and it works.

I have one more question:

I read the following from the how-cygtls-works.txt

"If you load cygwin1.dll dynamically from a non-cygwin application, it is
  vital that the bottom CYGTLS_PADSIZE bytes of the stack are not in use
  before you call cygwin_dll_init()"


How do I make sure bottom CYGTLS_PADSIZE bytes of the stack are not in use
before you call cygwin_dll_init()"

I could not find any information at: winsup/testsuite/cygload


On 5/2/07, Brian Dessent <brian@dessent.net> wrote:
> kalasad mailu wrote:
>
> > I am trying hard to get this stuff working!!!!!!  Could you please help me.
> >
> > I created a dll file (test.dll), which contains the function that
> > creates a socket and return the success/failure status. This file uses
> > the socket.h provided by cygwin. I compiled this dll using gcc on
> > cygwin.
> >
> > I also created a library file(testdll.lib) from this dll(test.dll).
> > When I tried to call the function defined in the test.dll in a program
> > (written in Microsoft Visual C++), this enters (that is created using
> > cygwin library), by a Microsoft Visual C++ program rean infinite loop.
> > The same program works fine if I call getuid or random function
> > instead of socket. And the stack is as below. I would really
> > appreciate if I can get some suggestions on how to get this working.
>
> The Cygwin DLL has special requirements for initialization.  This
> happens automatically for executables compiled with gcc, but otherwise
> you need to explicly init the library.  The details are all in the FAQ.
>
> > gcc -shared -I ../../cygwin/usr/include/cygwin -o testdll.dll test.cpp
> > -Wl,--output-def,testdll.def,--out-implib,libtestdll.a
> >
> > Command used to create the library file:
> >
> > "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\lib"
> > /machine:i386 /DEF:testdll.def
>
> Why not simply "cp libtest.dll.a testdll.lib"?  They're the same thing.
>
> Brian
>
> --
> 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/
>
>

--
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/

