apr_dso.h revision 251886
1193323Sed/* Licensed to the Apache Software Foundation (ASF) under one or more
2193323Sed * contributor license agreements.  See the NOTICE file distributed with
3193323Sed * this work for additional information regarding copyright ownership.
4193323Sed * The ASF licenses this file to You under the Apache License, Version 2.0
5193323Sed * (the "License"); you may not use this file except in compliance with
6193323Sed * the License.  You may obtain a copy of the License at
7193323Sed *
8193323Sed *     http://www.apache.org/licenses/LICENSE-2.0
9193323Sed *
10193323Sed * Unless required by applicable law or agreed to in writing, software
11193323Sed * distributed under the License is distributed on an "AS IS" BASIS,
12193323Sed * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13193323Sed * See the License for the specific language governing permissions and
14193323Sed * limitations under the License.
15193323Sed */
16193323Sed
17193323Sed#ifndef APR_DSO_DOT_H
18193323Sed#define APR_DSO_DOT_H
19218893Sdim
20193323Sed/**
21193323Sed * @file apr_dso.h
22193323Sed * @brief APR Dynamic Object Handling Routines
23193323Sed */
24193323Sed
25193323Sed#include "apr.h"
26193323Sed#include "apr_pools.h"
27193323Sed#include "apr_errno.h"
28193323Sed
29193323Sed#ifdef __cplusplus
30193323Sedextern "C" {
31193323Sed#endif
32193323Sed
33193323Sed/**
34193323Sed * @defgroup apr_dso Dynamic Object Handling
35193323Sed * @ingroup APR
36193323Sed * @{
37193323Sed */
38193323Sed
39218893Sdim#if APR_HAS_DSO || defined(DOXYGEN)
40193323Sed
41193323Sed/**
42193323Sed * Structure for referencing dynamic objects
43193323Sed */
44193323Sedtypedef struct apr_dso_handle_t       apr_dso_handle_t;
45193323Sed
46218893Sdim/**
47193323Sed * Structure for referencing symbols from dynamic objects
48193323Sed */
49234353Sdimtypedef void *                        apr_dso_handle_sym_t;
50193323Sed
51193323Sed/**
52193323Sed * Load a DSO library.
53193323Sed * @param res_handle Location to store new handle for the DSO.
54193323Sed * @param path Path to the DSO library
55193323Sed * @param ctx Pool to use.
56193323Sed * @bug We aught to provide an alternative to RTLD_GLOBAL, which
57193323Sed * is the only supported method of loading DSOs today.
58193323Sed */
59193323SedAPR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
60193323Sed                                       const char *path, apr_pool_t *ctx);
61193323Sed
62193323Sed/**
63193323Sed * Close a DSO library.
64193323Sed * @param handle handle to close.
65193323Sed */
66193323SedAPR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle);
67193323Sed
68218893Sdim/**
69193323Sed * Load a symbol from a DSO handle.
70193323Sed * @param ressym Location to store the loaded symbol
71193323Sed * @param handle handle to load the symbol from.
72208599Srdivacky * @param symname Name of the symbol to load.
73193323Sed */
74193323SedAPR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
75193323Sed                                      apr_dso_handle_t *handle,
76193323Sed                                      const char *symname);
77198892Srdivacky
78193323Sed/**
79193323Sed * Report more information when a DSO function fails.
80198892Srdivacky * @param dso The dso handle that has been opened
81193323Sed * @param buf Location to store the dso error
82218893Sdim * @param bufsize The size of the provided buffer
83208599Srdivacky */
84193323SedAPR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize);
85193323Sed
86193323Sed#endif /* APR_HAS_DSO */
87234353Sdim
88193323Sed/** @} */
89193323Sed
90193323Sed#ifdef __cplusplus
91234353Sdim}
92193323Sed#endif
93198892Srdivacky
94193323Sed#endif
95198892Srdivacky