* cygwin.din: add cygwin_dll_init
* dcrt0.cc (cygwin_dll_init): new (dll_crt0_1): short circuit if manually loaded * path.cc (mount_info::init): don't init if manually loaded
This commit is contained in:
		| @@ -1,3 +1,10 @@ | ||||
| 2000-06-07  DJ Delorie  <dj@cygnus.com> | ||||
|  | ||||
| 	* cygwin.din: add cygwin_dll_init | ||||
| 	* dcrt0.cc (cygwin_dll_init): new | ||||
| 	(dll_crt0_1): short circuit if manually loaded | ||||
| 	* path.cc (mount_info::init): don't init if manually loaded | ||||
|  | ||||
| Wed Jun  7 13:47:00 2000  Corinna Vinschen <corinna@vinschen.de> | ||||
|  | ||||
| 	* include/netinet/in_systm.h: New file. | ||||
|   | ||||
| @@ -125,6 +125,7 @@ _difftime = difftime | ||||
| div | ||||
| _div = div | ||||
| dll_crt0__FP11per_process | ||||
| cygwin_dll_init | ||||
| dll_dllcrt0 | ||||
| dll_noncygwin_dllcrt0 | ||||
| cygwin_detach_dll | ||||
|   | ||||
| @@ -724,6 +724,10 @@ dll_crt0_1 () | ||||
| /* Initialize uid, gid. */ | ||||
|   uinfo_init (); | ||||
|  | ||||
|   /* beyond this we only do for cygwin apps or dlls */ | ||||
|   if (dynamically_loaded) | ||||
|     return; | ||||
|  | ||||
|   /* Initialize signal/subprocess handling. */ | ||||
|   sigproc_init (); | ||||
|  | ||||
| @@ -842,6 +846,46 @@ dll_crt0 (per_process *uptr) | ||||
|   dll_crt0_1 (); | ||||
| } | ||||
|  | ||||
| extern "C" void *export_malloc (unsigned int); | ||||
| extern "C" void export_free (void *); | ||||
| extern "C" void *export_realloc (void *, unsigned int); | ||||
| extern "C" void *export_calloc (unsigned int, unsigned int); | ||||
|  | ||||
| /* This must be called by anyone who uses LoadLibrary to load cygwin1.dll */ | ||||
| extern "C" void cygwin_dll_init (); | ||||
| void | ||||
| cygwin_dll_init () | ||||
| { | ||||
|   static struct _reent *temp_impure; | ||||
|   static char **envp; | ||||
|   static int _fmode; | ||||
|   user_data->heapbase = user_data->heapptr = user_data->heaptop = NULL; | ||||
|  | ||||
|   if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (), | ||||
| 		       GetCurrentProcess (), &hMainProc, 0, FALSE, | ||||
| 			DUPLICATE_SAME_ACCESS)) | ||||
|     hMainProc = GetCurrentProcess (); | ||||
|  | ||||
|   DuplicateHandle (hMainProc, GetCurrentThread (), hMainProc, | ||||
| 		   &hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS); | ||||
|   user_data->dll_major = CYGWIN_VERSION_DLL_MAJOR; | ||||
|   user_data->dll_minor = CYGWIN_VERSION_DLL_MINOR; | ||||
|   user_data->api_major = CYGWIN_VERSION_API_MAJOR; | ||||
|   user_data->api_minor = CYGWIN_VERSION_API_MINOR; | ||||
|   user_data->magic_biscuit = sizeof (per_process); | ||||
|  | ||||
|   user_data->impure_ptr_ptr = &temp_impure; | ||||
|   user_data->envptr = &envp; | ||||
|   user_data->fmode_ptr = &_fmode; | ||||
|  | ||||
|   user_data->malloc = &export_malloc; | ||||
|   user_data->free = &export_free; | ||||
|   user_data->realloc = &export_realloc; | ||||
|   user_data->calloc = &export_calloc; | ||||
|  | ||||
|   dll_crt0_1 (); | ||||
| } | ||||
|  | ||||
| extern "C" void | ||||
| __main (void) | ||||
| { | ||||
|   | ||||
| @@ -854,6 +854,9 @@ mount_info::init () | ||||
|      the registry.  */ | ||||
|   from_registry (); | ||||
|  | ||||
|   if (dynamically_loaded) | ||||
|     return; | ||||
|  | ||||
|   /* If slash isn't already mounted, mount system directory as slash. */ | ||||
|   if (nmounts != 0) | ||||
|     for (int i = 0; i < nmounts; i++) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user