This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to add 4K of scratch space at the bottom of the stack using C instead of C++?


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@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]