LibreOffice: osl/module.h File Reference

LibreOffice LibreOffice 24.8 SDK C/C++ API Reference

Loading...
Searching...
No Matches
module.h File Reference
`#include "sal/config.h"`
`#include "rtl/ustring.h"`
`#include "sal/saldllapi.h"`

Go to the source code of this file.

## Macros
#define | SAL_MODULENAME(name)
#define | SAL_LOADMODULE_DEFAULT 0x00000
#define | SAL_LOADMODULE_LAZY 0x00001
#define | SAL_LOADMODULE_NOW 0x00002
#define | SAL_LOADMODULE_GLOBAL 0x00100

## Typedefs
typedef void * | oslModule
typedef void(* | oslGenericFunction) (void)
| Generic Function pointer type that will be used as symbol address.

## Functions
SAL_DLLPUBLIC oslModule | osl_loadModule (rtl_uString *strModuleName, sal_Int32 nRtldMode)
| Load a shared library or module.
SAL_DLLPUBLIC oslModule | osl_loadModuleAscii (const char *pModuleName, sal_Int32 nRtldMode)
| Load a shared library or module.
SAL_DLLPUBLIC oslModule | osl_loadModuleRelative (oslGenericFunction baseModule, rtl_uString *relativePath, sal_Int32 mode)
| Load a module located relative to some other module.
SAL_DLLPUBLIC oslModule | osl_loadModuleRelativeAscii (oslGenericFunction baseModule, char const *relativePath, sal_Int32 mode)
| Load a module located relative to some other module.
SAL_DLLPUBLIC sal_Bool | osl_getModuleHandle (rtl_uString *pModuleName, oslModule *pResult)
| Retrieve the handle of an already loaded module.
SAL_DLLPUBLIC void | osl_unloadModule (oslModule Module)
| Release the module.
SAL_DLLPUBLIC void * | osl_getSymbol (oslModule Module, rtl_uString *strSymbolName)
| lookup the specified symbol name.
SAL_DLLPUBLIC oslGenericFunction | osl_getFunctionSymbol (oslModule Module, rtl_uString *ustrFunctionSymbolName)
| Lookup the specified function symbol name.
SAL_DLLPUBLIC oslGenericFunction | osl_getAsciiFunctionSymbol (oslModule Module, const char *pSymbol)
| Lookup the specified function symbol name.
SAL_DLLPUBLIC sal_Bool | osl_getModuleURLFromAddress (void *pv, rtl_uString **pustrURL)
| Lookup URL of module which is mapped at the specified address.
SAL_DLLPUBLIC sal_Bool | osl_getModuleURLFromFunctionAddress (oslGenericFunction pf, rtl_uString **pustrFunctionURL)
| Lookup URL of module which is mapped at the specified function address.

## Macro Definition Documentation

## ◆ SAL_LOADMODULE_DEFAULT

#define SAL_LOADMODULE_DEFAULT 0x00000

## ◆ SAL_LOADMODULE_GLOBAL

#define SAL_LOADMODULE_GLOBAL 0x00100

## ◆ SAL_LOADMODULE_LAZY

#define SAL_LOADMODULE_LAZY 0x00001

## ◆ SAL_LOADMODULE_NOW

#define SAL_LOADMODULE_NOW 0x00002

## ◆ SAL_MODULENAME

#define SAL_MODULENAME | ( |  | name | ) |

Value:
name SAL_DLLEXTENSION

## Typedef Documentation

## ◆ oslGenericFunction

typedef void( * oslGenericFunction) (void)

Generic Function pointer type that will be used as symbol address.

See also
  osl_getFunctionSymbol.
  osl_getModuleURLFromFunctionAddress.

## ◆ oslModule

typedef void* oslModule

## Function Documentation

## ◆ osl_getAsciiFunctionSymbol()

SAL_DLLPUBLIC oslGenericFunction osl_getAsciiFunctionSymbol | ( | oslModule | Module,
|  | const char * | pSymbol )

Lookup the specified function symbol name.

osl_getAsciiFunctionSymbol is an alternative function for osl_getFunctionSymbol. It expects the C-style function name string to contain ascii characters only.

Parameters

  Module | [in] a module handle as returned by osl_loadModule or osl_getModuleHandle
  pSymbol | [in] Name of the function that will be looked up.

Return values

  function-address | on success
  NULL | lookup failed or the parameter are invalid

See also
  osl_getModuleHandle
  osl_getFunctionSymbol

## ◆ osl_getFunctionSymbol()

SAL_DLLPUBLIC oslGenericFunction osl_getFunctionSymbol | ( | oslModule | Module,
|  | rtl_uString * | ustrFunctionSymbolName )

Lookup the specified function symbol name.

osl_getFunctionSymbol is an alternative function for osl_getSymbol. Use Function pointer as symbol address to conceal type conversion.

Parameters

  [in] | Module | the handle of the Module.
  [in] | ustrFunctionSymbolName | Unicode name of the function that will be looked up.

Return values

  function-address | on success
  NULL | lookup failed or the parameter are invalid

See also
  osl_getSymbol
  osl_getAsciiFunctionSymbol

## ◆ osl_getModuleHandle()

SAL_DLLPUBLIC sal_Bool osl_getModuleHandle | ( | rtl_uString * | pModuleName,
|  | oslModule * | pResult )

Retrieve the handle of an already loaded module.

This function can be used to search for a function symbol in the process address space. Do not use the returned handle as an argument to osl_unloadModule. On Unix platforms, pModuleName gets ignored and the special handle RTLD_DEFAULT is returned.

Parameters

  [in] | pModuleName | denotes the name of the module to search for.

Attention
  Ignored on Unix.

Parameters

  [out] | pResult | a pointer to a oslModule that is updated with the requested module handle on success.

Return values

  sal_True | if the module handle could be retrieved and has been copied to *pResult.
  sal_False | if the module has not been loaded yet.

See also
  osl_getFunctionSymbol
  osl_getAsciiFunctionSymbol

## ◆ osl_getModuleURLFromAddress()

SAL_DLLPUBLIC sal_Bool osl_getModuleURLFromAddress | ( | void * | pv,
|  | rtl_uString ** | pustrURL )

Lookup URL of module which is mapped at the specified address.

Parameters

  [in] | pv | specifies an address in the process memory space.
  [out] | pustrURL | receives the URL of the module that is mapped at pv.

Returns
  sal_True on success, sal_False if no module can be found at the specified address.

## ◆ osl_getModuleURLFromFunctionAddress()

SAL_DLLPUBLIC sal_Bool osl_getModuleURLFromFunctionAddress | ( | oslGenericFunction | pf,
|  | rtl_uString ** | pustrFunctionURL )

Lookup URL of module which is mapped at the specified function address.

osl_getModuleURLFromFunctionAddress is an alternative function for osl_getModuleURLFromAddress. Use Function pointer as symbol address to conceal type conversion.

Parameters

  [in] | pf | function address in oslGenericFunction format.
  [out] | pustrFunctionURL | receives the URL of the module that is mapped at pf.

Return values

  sal_True | on success
  sal_False | no module can be found at the specified function address or parameter is somewhat invalid

See also
  osl_getModuleURLFromAddress

## ◆ osl_getSymbol()

SAL_DLLPUBLIC void * osl_getSymbol | ( | oslModule | Module,
|  | rtl_uString * | strSymbolName )

lookup the specified symbol name.

Parameters

  [in] | Module | the handle of the Module.
  [in] | strSymbolName | Name of the function that will be looked up.

Returns
  address of the symbol or NULL if lookup failed.

See also
  osl_getFunctionSymbol

## ◆ osl_loadModule()

SAL_DLLPUBLIC oslModule osl_loadModule | ( | rtl_uString * | strModuleName,
|  | sal_Int32 | nRtldMode )

Load a shared library or module.

Parameters

  [in] | strModuleName | denotes the name of the module to be loaded.
  [in] | nRtldMode | denotes the mode.

Returns
  NULL if the module could not be loaded, otherwise a handle to the module.

## ◆ osl_loadModuleAscii()

SAL_DLLPUBLIC oslModule osl_loadModuleAscii | ( | const char * | pModuleName,
|  | sal_Int32 | nRtldMode )

Load a shared library or module.

Parameters

  [in] | pModuleName | denotes the name of the module to be loaded.
  [in] | nRtldMode | denotes the mode.

Returns
  NULL if the module could not be loaded, otherwise a handle to the module.

Since
  UDK 3.6

## ◆ osl_loadModuleRelative()

SAL_DLLPUBLIC oslModule osl_loadModuleRelative | ( | oslGenericFunction | baseModule,
|  | rtl_uString * | relativePath,
|  | sal_Int32 | mode )

Load a module located relative to some other module.

Parameters

  [in] | baseModule | must point to a function that is part of the code of some loaded module; must not be NULL.
  [in] | relativePath | a relative URL; must not be NULL.
  [in] | mode | the SAL_LOADMODULE_xxx flags.

Returns
  a non-NULL handle to the loaded module, or NULL if an error occurred.

Since
  UDK 3.2.8

## ◆ osl_loadModuleRelativeAscii()

SAL_DLLPUBLIC oslModule osl_loadModuleRelativeAscii | ( | oslGenericFunction | baseModule,
|  | char const * | relativePath,
|  | sal_Int32 | mode )

Load a module located relative to some other module.

Parameters

  [in] | baseModule | must point to a function that is part of the code of some loaded module; must not be NULL.
  [in] | relativePath | a relative URL containing only ASCII (0x01–7F) characters; must not be NULL.
  [in] | mode | the SAL_LOADMODULE_xxx flags.

Returns
  a non-NULL handle to the loaded module, or NULL if an error occurred.

Since
  LibreOffice 3.5

## ◆ osl_unloadModule()

SAL_DLLPUBLIC void osl_unloadModule | ( | oslModule | Module | ) |

Release the module.