delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/02/18:01:21

X-Spam-Check-By: sourceware.org
Message-ID: <463909F9.6B33B9C7@dessent.net>
Date: Wed, 02 May 2007 15:00:25 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT 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
References: <507150040705021415r750600a6oc6e24b339bf57143 AT mail DOT gmail DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019