* dll_init.cc (dll_list::find_by_modname): new function to search the dll list for a module name only (no path). (dll_list::alloc): Initialize newly-added members of struct dll. (dll_list::append): new function to factor out the append operation (used by dll_list::topsort). (dll_list::populate_deps): new function to identify dll dependencies. (dll_list::topsort): new function to sort the dll list topologically by dependencies. (dll_list::topsort_visit): new helper function for the above. * dll_init.h (struct dll): added new class members for topsort. (struct dll_list): declare topsort-related functions. (struct pefile): allows simple introspection of dll images. * fork.cc (fork): topsort the dll list before forking. When the child loads each dll, all dependencies are already loaded and will no longer risk being pulled in unexpectedly.