1 /* 2 * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2002, Manuel J. Petit. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 9 10 #include "runtime_loader_private.h" 11 12 13 // exported via the rld_export structure in user space program arguments 14 15 16 static image_id 17 export_load_add_on(char const *name, uint32 flags) 18 { 19 void* handle; 20 return load_library(name, flags, true, &handle); 21 } 22 23 24 static status_t 25 export_unload_add_on(image_id id) 26 { 27 return unload_library(NULL, id, true); 28 } 29 30 31 static image_id 32 export_load_library(char const *name, uint32 flags, void **_handle) 33 { 34 return load_library(name, flags, false, _handle); 35 } 36 37 38 static status_t 39 export_unload_library(void* handle) 40 { 41 return unload_library(handle, -1, false); 42 } 43 44 45 struct rld_export gRuntimeLoader = { 46 // dynamic loading support API 47 export_load_add_on, 48 export_unload_add_on, 49 export_load_library, 50 export_unload_library, 51 get_symbol, 52 get_library_symbol, 53 get_nth_symbol, 54 test_executable, 55 get_next_image_dependency, 56 57 elf_reinit_after_fork, 58 NULL, // call_atexit_hooks_for_range 59 terminate_program 60 }; 61 62 63 void 64 rldexport_init(void) 65 { 66 gRuntimeLoader.program_args = gProgramArgs; 67 } 68