3 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008,
6 This file is part of Cygwin.
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
21 int (*main)(int, char **, char **);
22 per_module &operator = (per_process *p)
27 data_start = p->data_start;
28 data_end = p->data_end;
29 bss_start = p->bss_start;
49 struct dll *next, *prev;
73 #define MAX_DLL_BEFORE_INIT 100
85 dll *operator [] (const PWCHAR name);
86 dll *alloc (HINSTANCE, per_process *, dll_type);
90 void load_after_fork (HANDLE);
91 void reserve_space ();
92 void load_after_fork_impl (HANDLE, dll* which, int retries);
93 dll *find_by_modname (const PWCHAR name);
94 void populate_deps (dll* d);
96 void topsort_visit (dll* d, bool goto_tail);
101 while ((hold = hold->next))
102 if (hold_type == DLL_ANY || hold->type == hold_type)
107 dll *istart (dll_type t)
113 void guard(bool lockit)
120 friend void dll_global_dtors ();
121 dll_list () { protect.init ("dll_list"); }
125 http://msdn.microsoft.com/en-us/windows/hardware/gg463125
126 http://msdn.microsoft.com/en-us/library/ms809762.aspx
130 IMAGE_DOS_HEADER dos_hdr;
132 char* rva (long offset) { return (char*) this + offset; }
133 PIMAGE_NT_HEADERS32 pe_hdr () { return (PIMAGE_NT_HEADERS32) rva (dos_hdr.e_lfanew); }
134 PIMAGE_OPTIONAL_HEADER32 optional_hdr () { return &pe_hdr ()->OptionalHeader; }
135 PIMAGE_DATA_DIRECTORY idata_dir (DWORD which)
137 PIMAGE_OPTIONAL_HEADER32 oh = optional_hdr ();
138 return (which < oh->NumberOfRvaAndSizes)? oh->DataDirectory + which : 0;
142 extern dll_list dlls;
143 void dll_global_dtors ();
145 /* These probably belong in a newlib header but we can keep them here
147 extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
148 extern "C" int __cxa_finalize(void*);