Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 10 Jul 2005 23:58:25 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Yu-Cheng Chou cc: cygwin AT cygwin DOT com Subject: Re: How to add 4K of scratch space at the bottom of the stack using C instead of C++? In-Reply-To: <200507110327.j6B3RTaL026133@celerio.ucdavis.edu> Message-ID: References: <200507110327 DOT j6B3RTaL026133 AT celerio DOT ucdavis DOT edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sun, 10 Jul 2005, Yu-Cheng Chou wrote: > Hi, > In order to dynamically load cygwin1.dll with VC, I need to add 4K of > scratch space at the bottom of my stack. > > The winsup/testsuite/cygload/cygload.cpp shows how to do it using C++. I believe it's cygload.cc... > How can I add the scratch space using C rather than C++ in a simplest > way? I'm afraid it won't be very simple, but how about something like int main(int ac, char *av[]) { char padding[4096]; backup_lower_stack(); ... restore_lower_stack(); return ... } with backup_lower_stack() and restore_lower_stack() adapted from the cygwin::padding constructor and destructor, respectively (the vector can be replaced by a malloc'ed piece of memory). However, you'll also need to write a C interface to cygwin::connector. Once you have this working, I would strongly urge you to submit the code to Cygwin. HTH, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! If there's any real truth it's that the entire multidimensional infinity of the Universe is almost certainly being run by a bunch of maniacs. /DA -- 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/