fspr_dso.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef APR_DSO_DOT_H
  17. #define APR_DSO_DOT_H
  18. /**
  19. * @file fspr_dso.h
  20. * @brief APR Dynamic Object Handling Routines
  21. */
  22. #include "fspr.h"
  23. #include "fspr_pools.h"
  24. #include "fspr_errno.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /**
  29. * @defgroup fspr_dso Dynamic Object Handling
  30. * @ingroup APR
  31. * @{
  32. */
  33. #if APR_HAS_DSO || defined(DOXYGEN)
  34. /**
  35. * Structure for referencing dynamic objects
  36. */
  37. typedef struct fspr_dso_handle_t fspr_dso_handle_t;
  38. /**
  39. * Structure for referencing symbols from dynamic objects
  40. */
  41. typedef void * fspr_dso_handle_sym_t;
  42. /**
  43. * Load a DSO library.
  44. * @param res_handle Location to store new handle for the DSO.
  45. * @param path Path to the DSO library
  46. * @param ctx Pool to use.
  47. * @bug We aught to provide an alternative to RTLD_GLOBAL, which
  48. * is the only supported method of loading DSOs today.
  49. */
  50. APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle,
  51. const char *path, fspr_pool_t *ctx);
  52. /**
  53. * Close a DSO library.
  54. * @param handle handle to close.
  55. */
  56. APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle);
  57. /**
  58. * Load a symbol from a DSO handle.
  59. * @param ressym Location to store the loaded symbol
  60. * @param handle handle to load the symbol from.
  61. * @param symname Name of the symbol to load.
  62. */
  63. APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym,
  64. fspr_dso_handle_t *handle,
  65. const char *symname);
  66. /**
  67. * Report more information when a DSO function fails.
  68. * @param dso The dso handle that has been opened
  69. * @param buf Location to store the dso error
  70. * @param bufsize The size of the provided buffer
  71. */
  72. APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buf, fspr_size_t bufsize);
  73. #endif /* APR_HAS_DSO */
  74. /** @} */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif