apr_dso.h revision 251875
1251843Sbapt/* Licensed to the Apache Software Foundation (ASF) under one or more
2220749Snwhitehorn * contributor license agreements.  See the NOTICE file distributed with
3217309Snwhitehorn * this work for additional information regarding copyright ownership.
4217309Snwhitehorn * The ASF licenses this file to You under the Apache License, Version 2.0
5220749Snwhitehorn * (the "License"); you may not use this file except in compliance with
6220749Snwhitehorn * the License.  You may obtain a copy of the License at
7220749Snwhitehorn *
8220749Snwhitehorn *     http://www.apache.org/licenses/LICENSE-2.0
9220749Snwhitehorn *
10220749Snwhitehorn * Unless required by applicable law or agreed to in writing, software
11220749Snwhitehorn * distributed under the License is distributed on an "AS IS" BASIS,
12217309Snwhitehorn * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13217309Snwhitehorn * See the License for the specific language governing permissions and
14217309Snwhitehorn * limitations under the License.
15217309Snwhitehorn */
16217309Snwhitehorn
17217309Snwhitehorn#ifndef APR_DSO_DOT_H
18217309Snwhitehorn#define APR_DSO_DOT_H
19217309Snwhitehorn
20217309Snwhitehorn/**
21217309Snwhitehorn * @file apr_dso.h
22217309Snwhitehorn * @brief APR Dynamic Object Handling Routines
23217309Snwhitehorn */
24217309Snwhitehorn
25217309Snwhitehorn#include "apr.h"
26217309Snwhitehorn#include "apr_pools.h"
27217309Snwhitehorn#include "apr_errno.h"
28217309Snwhitehorn
29217309Snwhitehorn#ifdef __cplusplus
30217309Snwhitehornextern "C" {
31217309Snwhitehorn#endif
32217309Snwhitehorn
33217309Snwhitehorn/**
34217309Snwhitehorn * @defgroup apr_dso Dynamic Object Handling
35217309Snwhitehorn * @ingroup APR
36217309Snwhitehorn * @{
37217309Snwhitehorn */
38217309Snwhitehorn
39217309Snwhitehorn#if APR_HAS_DSO || defined(DOXYGEN)
40217309Snwhitehorn
41217309Snwhitehorn/**
42217309Snwhitehorn * Structure for referencing dynamic objects
43217309Snwhitehorn */
44217309Snwhitehorntypedef struct apr_dso_handle_t       apr_dso_handle_t;
45217309Snwhitehorn
46217309Snwhitehorn/**
47217309Snwhitehorn * Structure for referencing symbols from dynamic objects
48217309Snwhitehorn */
49217309Snwhitehorntypedef void *                        apr_dso_handle_sym_t;
50251843Sbapt
51217309Snwhitehorn/**
52217309Snwhitehorn * Load a DSO library.
53251843Sbapt * @param res_handle Location to store new handle for the DSO.
54217309Snwhitehorn * @param path Path to the DSO library
55217309Snwhitehorn * @param ctx Pool to use.
56217309Snwhitehorn * @bug We aught to provide an alternative to RTLD_GLOBAL, which
57217309Snwhitehorn * is the only supported method of loading DSOs today.
58217309Snwhitehorn */
59217309SnwhitehornAPR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
60217309Snwhitehorn                                       const char *path, apr_pool_t *ctx);
61217309Snwhitehorn
62217309Snwhitehorn/**
63217309Snwhitehorn * Close a DSO library.
64217309Snwhitehorn * @param handle handle to close.
65251843Sbapt */
66217309SnwhitehornAPR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle);
67217309Snwhitehorn
68251843Sbapt/**
69217309Snwhitehorn * Load a symbol from a DSO handle.
70217309Snwhitehorn * @param ressym Location to store the loaded symbol
71251843Sbapt * @param handle handle to load the symbol from.
72217309Snwhitehorn * @param symname Name of the symbol to load.
73217309Snwhitehorn */
74251843SbaptAPR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
75217309Snwhitehorn                                      apr_dso_handle_t *handle,
76217309Snwhitehorn                                      const char *symname);
77251843Sbapt
78217309Snwhitehorn/**
79217309Snwhitehorn * Report more information when a DSO function fails.
80251843Sbapt * @param dso The dso handle that has been opened
81217309Snwhitehorn * @param buf Location to store the dso error
82217309Snwhitehorn * @param bufsize The size of the provided buffer
83251843Sbapt */
84217309SnwhitehornAPR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize);
85217309Snwhitehorn
86251843Sbapt#endif /* APR_HAS_DSO */
87217309Snwhitehorn
88217309Snwhitehorn/** @} */
89251843Sbapt
90217309Snwhitehorn#ifdef __cplusplus
91217309Snwhitehorn}
92251843Sbapt#endif
93217309Snwhitehorn
94217309Snwhitehorn#endif
95251843Sbapt