diff options
author | Christopher Faylor <me@cgf.cx> | 2005-06-04 02:11:50 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-06-04 02:11:50 +0000 |
commit | 6e780c8bf5805e72414adad805f40ef4df1ebf57 (patch) | |
tree | b432d94f272dd9da96fd63d5602437f44aaff824 /winsup/cygwin/dcrt0.cc | |
parent | 15c04fd16e2f6a8725311eeff9f5093524c6cf4f (diff) | |
download | cygnal-6e780c8bf5805e72414adad805f40ef4df1ebf57.tar.gz cygnal-6e780c8bf5805e72414adad805f40ef4df1ebf57.tar.bz2 cygnal-6e780c8bf5805e72414adad805f40ef4df1ebf57.zip |
* dcrt0.cc (cygwin_dll_init): Now initializes main_environ and cygtls. Comment
to explain the caveats of this method.
* how-cygtls-works.txt: New file.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 4f643ae1e..457661000 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -955,7 +955,15 @@ dll_crt0 (per_process *uptr) _dll_crt0 (); } -/* This must be called by anyone who uses LoadLibrary to load cygwin1.dll */ +/* This must be called by anyone who uses LoadLibrary to load cygwin1.dll. + * You must have CYGTLS_PADSIZE bytes reserved at the bottom of the stack + * calling this function, and that storage must not be overwritten until you + * unload cygwin1.dll, as it is used for _my_tls. It is best to load + * cygwin1.dll before spawning any additional threads in your process. + * + * See winsup/testsuite/cygload for an example of how to use cygwin1.dll + * from MSVC and non-cygwin MinGW applications. + */ extern "C" void cygwin_dll_init () { @@ -974,6 +982,9 @@ cygwin_dll_init () user_data->envptr = &envp; user_data->fmode_ptr = &_fmode; + main_environ = user_data->envptr; + *main_environ = NULL; + initialize_main_tls((char *)&_my_tls); dll_crt0_1 (NULL); } |