tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / osl / module.h
blob9d80d352afaa831fe0a968ecc9cea1a935054b41
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 * This file is part of LibreOffice published API.
24 #ifndef INCLUDED_OSL_MODULE_H
25 #define INCLUDED_OSL_MODULE_H
27 #include "sal/config.h"
29 #include "rtl/ustring.h"
30 #include "sal/saldllapi.h"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #ifdef SAL_DLLPREFIX
37 #define SAL_MODULENAME(name) SAL_DLLPREFIX name SAL_DLLEXTENSION
38 #else
39 #define SAL_MODULENAME(name) name SAL_DLLEXTENSION
40 #endif
42 #if defined(_WIN32)
43 #define SAL_MODULENAME_WITH_VERSION(name, version) name version SAL_DLLEXTENSION
45 #elif defined(SAL_UNX)
46 #if defined(MACOSX)
47 #define SAL_MODULENAME_WITH_VERSION(name, version) SAL_DLLPREFIX name ".dylib." version
48 #else
49 #define SAL_MODULENAME_WITH_VERSION(name, version) SAL_DLLPREFIX name SAL_DLLEXTENSION "." version
50 #endif
52 #endif
54 #define SAL_LOADMODULE_DEFAULT 0x00000
55 #define SAL_LOADMODULE_LAZY 0x00001
56 #define SAL_LOADMODULE_NOW 0x00002
57 #define SAL_LOADMODULE_GLOBAL 0x00100
59 typedef void* oslModule;
61 /** Generic Function pointer type that will be used as symbol address.
63 @see osl_getFunctionSymbol.
64 @see osl_getModuleURLFromFunctionAddress.
66 typedef void ( SAL_CALL *oslGenericFunction )( void );
68 #ifndef DISABLE_DYNLOADING
70 /** Load a shared library or module.
72 @param[in] strModuleName denotes the name of the module to be loaded.
73 @param[in] nRtldMode denotes the mode.
75 @returns NULL if the module could not be loaded, otherwise a handle to the module.
77 SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMode);
79 /** Load a shared library or module.
81 @param[in] pModuleName denotes the name of the module to be loaded.
82 @param[in] nRtldMode denotes the mode.
84 @return NULL if the module could not be loaded, otherwise a handle to the module.
86 @since UDK 3.6
88 SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleAscii(const char *pModuleName, sal_Int32 nRtldMode);
90 /** Load a module located relative to some other module.
92 @param[in] baseModule must point to a function that is part of the code of some loaded module;
93 must not be NULL.
94 @param[in] relativePath a relative URL; must not be NULL.
95 @param[in] mode the SAL_LOADMODULE_xxx flags.
97 @return a non-NULL handle to the loaded module, or NULL if an error occurred.
99 @since UDK 3.2.8
101 SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleRelative(
102 oslGenericFunction baseModule, rtl_uString * relativePath, sal_Int32 mode);
104 /** Load a module located relative to some other module.
106 @param[in] baseModule must point to a function that is part of the code of some loaded module;
107 must not be NULL.
108 @param[in] relativePath a relative URL containing only ASCII (0x01--7F) characters;
109 must not be NULL.
110 @param[in] mode the SAL_LOADMODULE_xxx flags.
112 @return a non-NULL handle to the loaded module, or NULL if an error occurred.
114 @since LibreOffice 3.5
116 SAL_DLLPUBLIC oslModule SAL_CALL osl_loadModuleRelativeAscii(
117 oslGenericFunction baseModule, char const * relativePath, sal_Int32 mode);
118 /* This function is guaranteed not to call into
119 FullTextEncodingDataSingleton in sal/textenc/textenc.cxx, so can be used
120 in its implementation without running into circles. */
122 #endif
124 /** Retrieve the handle of an already loaded module.
126 This function can be used to search for a function symbol in the process address space.
127 Do not use the returned handle as an argument to osl_unloadModule. On Unix platforms,
128 pModuleName gets ignored and the special handle RTLD_DEFAULT is returned.
130 @param[in] pModuleName denotes the name of the module to search for.
131 @attention Ignored on Unix.
132 @param[out] pResult a pointer to a oslModule that is updated with the
133 requested module handle on success.
135 @retval sal_True if the module handle could be retrieved and has been copied to *pResult.
136 @retval sal_False if the module has not been loaded yet.
138 @see osl_getFunctionSymbol
139 @see osl_getAsciiFunctionSymbol
141 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult);
143 #ifndef DISABLE_DYNLOADING
145 /** Release the module
147 SAL_DLLPUBLIC void SAL_CALL osl_unloadModule(oslModule Module);
149 #endif
151 /** lookup the specified symbol name.
153 @param[in] Module the handle of the Module.
154 @param[in] strSymbolName Name of the function that will be looked up.
156 @return address of the symbol or NULL if lookup failed.
158 @see osl_getFunctionSymbol
160 SAL_DLLPUBLIC void* SAL_CALL osl_getSymbol( oslModule Module, rtl_uString *strSymbolName);
162 /** Lookup the specified function symbol name.
164 osl_getFunctionSymbol is an alternative function for osl_getSymbol.
165 Use Function pointer as symbol address to conceal type conversion.
167 @param[in] Module the handle of the Module.
168 @param[in] ustrFunctionSymbolName Unicode name of the function that will be looked up.
170 @retval function-address on success
171 @retval NULL lookup failed or the parameter are invalid
173 @see osl_getSymbol
174 @see osl_getAsciiFunctionSymbol
176 SAL_DLLPUBLIC oslGenericFunction SAL_CALL osl_getFunctionSymbol(
177 oslModule Module, rtl_uString *ustrFunctionSymbolName );
179 /** Lookup the specified function symbol name.
181 osl_getAsciiFunctionSymbol is an alternative function for osl_getFunctionSymbol.
182 It expects the C-style function name string to contain ascii characters only.
184 @param Module
185 [in] a module handle as returned by osl_loadModule or osl_getModuleHandle
187 @param pSymbol
188 [in] Name of the function that will be looked up.
190 @retval function-address on success
191 @retval NULL lookup failed or the parameter are invalid
193 @see osl_getModuleHandle
194 @see osl_getFunctionSymbol
196 SAL_DLLPUBLIC oslGenericFunction SAL_CALL osl_getAsciiFunctionSymbol(
197 oslModule Module, const char *pSymbol );
199 /** Lookup URL of module which is mapped at the specified address.
201 @param[in] pv specifies an address in the process memory space.
202 @param[out] pustrURL receives the URL of the module that is mapped at pv.
203 @return sal_True on success, sal_False if no module can be found at the specified address.
205 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleURLFromAddress(
206 void *pv, rtl_uString **pustrURL );
208 /** Lookup URL of module which is mapped at the specified function address.
210 osl_getModuleURLFromFunctionAddress is an alternative function for osl_getModuleURLFromAddress.
211 Use Function pointer as symbol address to conceal type conversion.
213 @param[in] pf function address in oslGenericFunction format.
214 @param[out] pustrFunctionURL receives the URL of the module that is mapped at pf.
216 @retval sal_True on success
217 @retval sal_False no module can be found at the specified function address or parameter is somewhat invalid
219 @see osl_getModuleURLFromAddress
221 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_getModuleURLFromFunctionAddress(
222 oslGenericFunction pf, rtl_uString **pustrFunctionURL );
224 #ifdef __cplusplus
226 #endif
228 #endif // INCLUDED_OSL_MODULE_H
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */