From: cgf AT cygnus DOT com (Christopher Faylor) Subject: Re: DLL init patch for loading cygwin DLL from MSVC app 28 Oct 1998 20:11:03 -0800 Message-ID: <19981028220239.A20406.cygnus.cygwin32.developers@cygnus.com> References: <19981028213210 DOT A20153 AT cygnus DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Mumit Khan Cc: cygwin32-developers AT cygnus DOT com, noer AT cygnus DOT com On Wed, Oct 28, 1998 at 08:53:56PM -0600, Mumit Khan wrote: >On Wed, 28 Oct 1998, Christopher Faylor wrote: >> >> Did you ever manage to get an strace log on this? It sounds like that >> would pinpoint the problem pretty quickly. >> > >Actually, there are multiple problems. dll_crt0 is probably really only >appropriate for a cygwin app, and not for a cygwin dll loaded in a non- >cygwin app. If we call dll_crt0, here's some of the problems I see: > > - the first problem is that the global constructors are called multiple > times; Why is this? Who else is calling the cygwin constructors? > - it calls exit (user->main), so that needs to be take care, possibly > by saving the DLL main, NULL'ing it and then calling dll_crt0. This > is the easiest one to get around; Yup. > - then the initialization hangs in sigproc_init() -- in makethread; That would be an indication of makethread not receiving the "thread ready" event. I'm not sure why this would happen in this context unless it is a malloc problem, possibly. >I think we need to do more than just call dll_crt0 to initialize ... Ok. I'm convinced. It sounds like dll_crt0_1 will need to be reorganized to do what you need done. I had moved things around a while ago in a private copy of the source so that a lot of the initialization was done when the dll was loaded rather than when dll_crt0 was called from cygwin_crt0 (there are too many crt0's in this code, IMO). I didn't follow through with this because I couldn't get a clean separation without breaking binary compatibility. We're anticipating that binary compatibility will break in B21 anyway, so this will be a good time to get this done. cgf