Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Date: Sat, 15 Jul 2000 00:47:37 -0400 From: Chris Faylor To: "'cygwin-developers AT sourceware DOT cygnus DOT com'" Subject: Re: _impure_ptr uninitialized in DLLs? Message-ID: <20000715004737.A16042@cygnus.com> Reply-To: cygwin-developers AT sourceware DOT cygnus DOT com Mail-Followup-To: "'cygwin-developers AT sourceware DOT cygnus DOT com'" References: <779F20BCCE5AD31186A50008C75D9979171746 AT silldn_mail1 DOT sanwaint DOT com> <20000712224227 DOT A7487 AT cygnus DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000712224227.A7487@cygnus.com>; from cgf@cygnus.com on Wed, Jul 12, 2000 at 10:42:27PM -0400 On Wed, Jul 12, 2000 at 10:42:27PM -0400, Chris Faylor wrote: >On Wed, Jul 12, 2000 at 07:03:07PM +0100, Fifer, Eric wrote: >>>This should be fixed in CVS now. It will require updating libcygwin.a. >> >>I'm still having problems. The dlopen() flavor works now, but when >>linking against a normal DLL, environ is NULL in the main program. >> >>Here's another demonstration: > >I see the problem. I've been resisting the urge to rewrite the dll_init.cc >rat's nest. I don't know how much longer I can hold out. Phew. Well, I couldn't hold out. I've rewritten dll_init.{c,h}. I'm sure that I've introduced some new bugs but Eric's problems now seem to be fixed. For additional testing, I also wrote a perl script which used a couple of dlls, and then forks and uses functions from the dlls again. Perl's use of DLLs have always been problematic but they seemed to work in this simple scenario. (I *really* need to set up a cygwin test suite) >In scratching this bug I found another problem. dll_init routines can use >malloc in some circumstances. This means that there is a potential deadlock >situation since DLL initialization is serialized and malloc uses a mutex >to serialize its access. Getting things working in such a way that malloc was not used was very tricky. It seems to work for WNT and W95 but... These change will require updating both cygwin1.dll *and* libcygwin.a, YA. cgf