apr_dso.h revision 251886
118099Spst/* Licensed to the Apache Software Foundation (ASF) under one or more
255844Sasmodai * contributor license agreements.  See the NOTICE file distributed with
318099Spst * this work for additional information regarding copyright ownership.
418099Spst * The ASF licenses this file to You under the Apache License, Version 2.0
518099Spst * (the "License"); you may not use this file except in compliance with
618099Spst * the License.  You may obtain a copy of the License at
718099Spst *
818099Spst *     http://www.apache.org/licenses/LICENSE-2.0
918099Spst *
1018099Spst * Unless required by applicable law or agreed to in writing, software
1118099Spst * distributed under the License is distributed on an "AS IS" BASIS,
1218099Spst * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1318099Spst * See the License for the specific language governing permissions and
1418099Spst * limitations under the License.
1518099Spst */
1618099Spst
1718099Spst#ifndef APR_DSO_DOT_H
1851622Sphantom#define APR_DSO_DOT_H
1951622Sphantom
2051622Sphantom/**
2118099Spst * @file apr_dso.h
2218099Spst * @brief APR Dynamic Object Handling Routines
2318099Spst */
2418099Spst
2518099Spst#include "apr.h"
2618099Spst#include "apr_pools.h"
2718099Spst#include "apr_errno.h"
2818099Spst
2918099Spst#ifdef __cplusplus
3018099Spstextern "C" {
3118099Spst#endif
3218099Spst
3318099Spst/**
3418099Spst * @defgroup apr_dso Dynamic Object Handling
3518099Spst * @ingroup APR
3618099Spst * @{
3718099Spst */
3818099Spst
3918099Spst#if APR_HAS_DSO || defined(DOXYGEN)
4018099Spst
4118099Spst/**
4218099Spst * Structure for referencing dynamic objects
4351622Sphantom */
4451622Sphantomtypedef struct apr_dso_handle_t       apr_dso_handle_t;
4551622Sphantom
4618099Spst/**
4718099Spst * Structure for referencing symbols from dynamic objects
4818099Spst */
4951622Sphantomtypedef void *                        apr_dso_handle_sym_t;
5051622Sphantom
5151622Sphantom/**
5218099Spst * Load a DSO library.
5318099Spst * @param res_handle Location to store new handle for the DSO.
5418099Spst * @param path Path to the DSO library
5518099Spst * @param ctx Pool to use.
5618099Spst * @bug We aught to provide an alternative to RTLD_GLOBAL, which
5718099Spst * is the only supported method of loading DSOs today.
5818099Spst */
5918099SpstAPR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
6018099Spst                                       const char *path, apr_pool_t *ctx);
6118099Spst
6218099Spst/**
6318099Spst * Close a DSO library.
6418099Spst * @param handle handle to close.
6518099Spst */
6618099SpstAPR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle);
6718099Spst
6818099Spst/**
6918128Spst * Load a symbol from a DSO handle.
7018128Spst * @param ressym Location to store the loaded symbol
7118099Spst * @param handle handle to load the symbol from.
7218099Spst * @param symname Name of the symbol to load.
7318099Spst */
7418099SpstAPR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
7518099Spst                                      apr_dso_handle_t *handle,
7618099Spst                                      const char *symname);
7718099Spst
7818099Spst/**
7918099Spst * Report more information when a DSO function fails.
8018099Spst * @param dso The dso handle that has been opened
8118099Spst * @param buf Location to store the dso error
8218099Spst * @param bufsize The size of the provided buffer
8351622Sphantom */
8451622SphantomAPR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize);
8551622Sphantom
8618099Spst#endif /* APR_HAS_DSO */
8751622Sphantom
8818099Spst/** @} */
8918099Spst
9018099Spst#ifdef __cplusplus
9118099Spst}
9218099Spst#endif
9318099Spst
9418099Spst#endif
9518099Spst