OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CRAZY_LINKER_H | 5 #ifndef CRAZY_LINKER_H |
6 #define CRAZY_LINKER_H | 6 #define CRAZY_LINKER_H |
7 | 7 |
8 // This is the crazy linker, a custom dynamic linker that can be used | 8 // This is the crazy linker, a custom dynamic linker that can be used |
9 // by NDK applications to load shared libraries (not executables) with | 9 // by NDK applications to load shared libraries (not executables) with |
10 // a twist. | 10 // a twist. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // to the library being loaded (when not already in the process). If the | 208 // to the library being loaded (when not already in the process). If the |
209 // operations needs to load any dependency libraries, these will use | 209 // operations needs to load any dependency libraries, these will use |
210 // offset and address values of 0 to do so. | 210 // offset and address values of 0 to do so. |
211 // | 211 // |
212 // NOTE: It is possible to open NDK system libraries (e.g. "liblog.so") | 212 // NOTE: It is possible to open NDK system libraries (e.g. "liblog.so") |
213 // with this function, but they will be loaded with the system dlopen(). | 213 // with this function, but they will be loaded with the system dlopen(). |
214 crazy_status_t crazy_library_open(crazy_library_t** library, | 214 crazy_status_t crazy_library_open(crazy_library_t** library, |
215 const char* lib_name, | 215 const char* lib_name, |
216 crazy_context_t* context) _CRAZY_PUBLIC; | 216 crazy_context_t* context) _CRAZY_PUBLIC; |
217 | 217 |
| 218 // Return the pathname of the library in the zip_file: |
| 219 // "lib/<abi>/crazy.<lib_name>". |
| 220 // Result is returned in buffer[0..buffer_size - 1]. If buffer_size is too |
| 221 // small CRAZY_STATUS_FAILURE is returned. |
| 222 crazy_status_t crazy_library_filename_in_zip_file( |
| 223 const char* lib_name, char* buffer, size_t buffer_size); |
| 224 |
218 // Try to open or load a library with the crazy linker. The | 225 // Try to open or load a library with the crazy linker. The |
219 // library is in a zip file with the name |zipfile_name|. Within the zip | 226 // library is in a zip file with the name |zipfile_name|. Within the zip |
220 // file the library must be uncompressed and page aligned. |zipfile_name| | 227 // file the library must be uncompressed and page aligned. |zipfile_name| |
221 // should be an absolute path name and |lib_name| should be a relative | 228 // should be an absolute path name and |lib_name| should be a relative |
222 // pathname. The library in the zip file is expected to have the name | 229 // pathname. The library in the zip file is expected to have the name |
223 // lib/<abi_tag>/crazy.<lib_name> where abi_tag is the abi directory matching | 230 // lib/<abi_tag>/crazy.<lib_name> where abi_tag is the abi directory matching |
224 // the ABI for which the crazy linker was compiled. Note this does not support | 231 // the ABI for which the crazy linker was compiled. Note this does not support |
225 // opening multiple libraries in the same zipfile, see crbug/388223. | 232 // opening multiple libraries in the same zipfile, see crbug/388223. |
226 crazy_status_t crazy_library_open_in_zip_file(crazy_library_t** library, | 233 crazy_status_t crazy_library_open_in_zip_file(crazy_library_t** library, |
227 const char* zipfile_name, | 234 const char* zipfile_name, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 348 |
342 // Close a library, with associated context to support delayed operations. | 349 // Close a library, with associated context to support delayed operations. |
343 void crazy_library_close_with_context(crazy_library_t* library, | 350 void crazy_library_close_with_context(crazy_library_t* library, |
344 crazy_context_t* context) _CRAZY_PUBLIC; | 351 crazy_context_t* context) _CRAZY_PUBLIC; |
345 | 352 |
346 #ifdef __cplusplus | 353 #ifdef __cplusplus |
347 } /* extern "C" */ | 354 } /* extern "C" */ |
348 #endif | 355 #endif |
349 | 356 |
350 #endif /* CRAZY_LINKER_H */ | 357 #endif /* CRAZY_LINKER_H */ |
OLD | NEW |