0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / OSD / OSD_SharedLibrary.hxx
CommitLineData
42cf5bc1 1// Created on: 1994-08-30
2// Created by: J.P. TIRAULT
3// Copyright (c) 1994-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _OSD_SharedLibrary_HeaderFile
18#define _OSD_SharedLibrary_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
42cf5bc1 22
42cf5bc1 23#include <Standard_PCharacter.hxx>
42cf5bc1 24#include <OSD_LoadMode.hxx>
25#include <OSD_Function.hxx>
26
27
28//! Interface to dynamic library loader.
29//! Provides tools to load a shared library
30//! and retrieve the address of an entry point.
31class OSD_SharedLibrary
32{
33public:
34
35 DEFINE_STANDARD_ALLOC
36
37
38 //! Creates a SharedLibrary object with name NULL.
39 Standard_EXPORT OSD_SharedLibrary();
40
41 //! Creates a SharedLibrary object with name aFilename.
42 Standard_EXPORT OSD_SharedLibrary(const Standard_CString aFilename);
43
44 //! Sets a name associated to the shared object.
45 Standard_EXPORT void SetName (const Standard_CString aName);
46
47 //! Returns the name associated to the shared object.
48 Standard_EXPORT Standard_CString Name() const;
49
50 //! The DlOpen method provides an interface to the
51 //! dynamic library loader to allow shared libraries
52 //! to be loaded and called at runtime. The DlOpen
53 //! function attempts to load Filename, in the address
54 //! space of the process, resolving symbols as appropriate.
55 //! Any libraries that Filename depends upon are also loaded.
56 //! If MODE is RTLD_LAZY, then the runtime loader
57 //! does symbol resolution only as needed.
58 //! Typically, this means that the first call to a function
59 //! in the newly loaded library will cause the resolution of
60 //! the address of that function to occur.
61 //! If Mode is RTLD_NOW, then the runtime loader must do all
62 //! symbol binding during the DlOpen call.
63 //! The DlOpen method returns a handle that is used by DlSym
64 //! or DlClose.
65 //! If there is an error, Standard_False is returned,
66 //! Standard_True otherwise.
67 //! If a NULL Filename is specified, DlOpen returns a handle
68 //! for the main executable, which allows access to dynamic
69 //! symbols in the running program.
70 Standard_EXPORT Standard_Boolean DlOpen (const OSD_LoadMode Mode);
71
72 //! The dlsym function returns the address of the
73 //! symbol name found in the shared library.
74 //! If the symbol is not found, a NULL pointer is
75 //! returned.
76 Standard_EXPORT OSD_Function DlSymb (const Standard_CString Name) const;
77
78 //! Deallocates the address space for the library
79 //! corresponding to the shared object.
80 //! If any user function continues to call a symbol
81 //! resolved in the address space of a library
82 //! that has been since been deallocated by DlClose,
83 //! the results are undefined.
84 Standard_EXPORT void DlClose() const;
85
86 //! The dlerror function returns a string describing
87 //! the last error that occurred from
88 //! a call to DlOpen, DlClose or DlSym.
89 Standard_EXPORT Standard_CString DlError() const;
90
91 //! Frees memory allocated.
92 Standard_EXPORT void Destroy();
93~OSD_SharedLibrary()
94{
95 Destroy();
96}
97
98
99
100
101protected:
102
103
104
105
106
107private:
108
109
110
111 Standard_Address myHandle;
112 Standard_PCharacter myName;
113
114
115};
116
117
118
119
120
121
122
123#endif // _OSD_SharedLibrary_HeaderFile