delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/06/23/13:16:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Subject: Re: How to make DLLs in cygwin for MSVC and BCB
From: Max Kaehn <slothman AT electric-cloud DOT com>
To: cygwin AT cygwin DOT com
In-Reply-To: <d9e863$bm8$1@sea.gmane.org>
References: <d9bu24$aa1$1 AT sea DOT gmane DOT org> <42B9854D DOT DBC0BD AT dessent DOT net> <d9c2k1$q7v$1 AT sea DOT gmane DOT org> <1119461463 DOT 6224 DOT 11 DOT camel AT fulgurite> <d9e863$bm8$1 AT sea DOT gmane DOT org>
Date: Thu, 23 Jun 2005 10:15:55 -0700
Message-Id: <1119546955.6224.17.camel@fulgurite>
Mime-Version: 1.0
X-IsSubscribed: yes

On Thu, 2005-06-23 at 14:05 +0200, Patrick Rotsaert wrote:
> Ok, but this was only a small test program to see if I manage to load 
> cygwin1.dll functions.
> The plan is to do this in a DLL, later on. I guess cygwin_dll_init will 
> then have to be called in DllMain, yes?
> But then, what happens when DllMain returns? The stack space will no 
> longer exist.

You'll need to find some way to arrange that the 4K is available at
the bottom of the stack of your main thread for as long as you have
cygwin1.dll loaded.  Any thread spawned once cygwin1.dll is loaded will
automatically have the 4K inserted, but for your main thread, you need
to do stunts like
---
extern "C" int mainCRTStartup ();

extern "C" int __stdcall
cygwinFriendlyCRTStartup ()
{
  char buf[4096];
  return mainCRTStartup ();
}
---
and link with cygwinFriendlyCRTStartup as your entry point.

If you spawn other threads before you load cygwin1.dll, you should
not call any cygwin functions from those threads.



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