1 /**
2  * @copyright
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_dso.h
24  * @brief DSO loading routines
25  */
26 
27 
28 
29 #ifndef SVN_DSO_H
30 #define SVN_DSO_H
31 
32 #include <apr_dso.h>
33 
34 #include "svn_types.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 /**
41  * Initialize the DSO loading routines.
42  *
43  * @note This should be called prior to the creation of any pool that
44  *       is passed to a function that comes from a DSO, otherwise you
45  *       risk having the DSO unloaded before all pool cleanup callbacks
46  *       that live in the DSO have been executed.  If it is not called
47  *       prior to @c svn_dso_load being used for the first time there
48  *       will be a best effort attempt made to initialize the subsystem,
49  *       but it will not be entirely thread safe and it risks running
50  *       into the previously mentioned problems with DSO unloading and
51  *       pool cleanup callbacks.
52  *
53  * Returns svn_error_t object with corresponding apr_err returned by
54  * underlying calls. In case of no error returns @c SVN_NO_ERROR.
55  *
56  * @since New in 1.6.
57  */
58 svn_error_t *
59 svn_dso_initialize2(void);
60 
61 /** The same as svn_dso_initialize2(), except that if there is an error this
62  * calls abort() instead of returning the error.
63  *
64  * @deprecated Provided for backwards compatibility with the 1.5 API.
65  *
66  * @since New in 1.4.
67  */
68 SVN_DEPRECATED
69 void
70 svn_dso_initialize(void);
71 
72 
73 #if APR_HAS_DSO
74 
75 /**
76  * Attempt to load @a libname, returning it in @a *dso.
77  *
78  * If @a libname cannot be loaded set @a *dso to NULL and return
79  * @c SVN_NO_ERROR.
80  *
81  * @note Due to pool lifetime issues DSOs are all loaded into a global
82  *       pool, so you must be certain that there is a bounded number of
83  *       them that will ever be loaded by the system, otherwise you will
84  *       leak memory.
85  *
86  * @since New in 1.4.
87  */
88 svn_error_t *
89 svn_dso_load(apr_dso_handle_t **dso,
90              const char *libname);
91 
92 #endif /* APR_HAS_DSO */
93 
94 
95 #ifdef __cplusplus
96 }
97 #endif /* __cplusplus */
98 
99 #endif /* SVN_DSO_H */
100