rcutils  master
C API providing common utilities and data structures.
shared_library.h
Go to the documentation of this file.
1 // Copyright 2020 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 #ifndef RCUTILS__SHARED_LIBRARY_H_
18 #define RCUTILS__SHARED_LIBRARY_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include <string.h>
26 
27 #include "rcutils/allocator.h"
29 #include "rcutils/macros.h"
31 
34 {
36  void * lib_pointer;
38  char * library_path;
42 
44 
74 
76 
90  const char * library_path,
91  rcutils_allocator_t allocator);
92 
94 
102 void *
103 rcutils_get_symbol(const rcutils_shared_library_t * lib, const char * symbol_name);
104 
106 
114 bool
115 rcutils_has_symbol(const rcutils_shared_library_t * lib, const char * symbol_name);
116 
118 
128 
130 
140 bool
142 
144 
157  const char * library_name,
158  char * library_name_platform,
159  unsigned int buffer_size,
160  bool debug);
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif // RCUTILS__SHARED_LIBRARY_H_
rcutils_shared_library_t
struct rcutils_shared_library_t rcutils_shared_library_t
Handle to a loaded shared library.
rcutils_has_symbol
bool rcutils_has_symbol(const rcutils_shared_library_t *lib, const char *symbol_name)
Return true if the shared library contains a specific symbol name otherwise returns false.
rcutils_unload_shared_library
rcutils_ret_t rcutils_unload_shared_library(rcutils_shared_library_t *lib)
Unload the shared library.
macros.h
rcutils_shared_library_t
Handle to a loaded shared library.
Definition: shared_library.h:33
rcutils_shared_library_t::lib_pointer
void * lib_pointer
The platform-specific pointer to the shared library.
Definition: shared_library.h:36
rcutils_shared_library_t::library_path
char * library_path
The path of the shared_library.
Definition: shared_library.h:38
rcutils_get_zero_initialized_shared_library
rcutils_shared_library_t rcutils_get_zero_initialized_shared_library(void)
Return an empty shared library struct.
RCUTILS_PUBLIC_TYPE
#define RCUTILS_PUBLIC_TYPE
Definition: visibility_control.h:29
rcutils_shared_library_t::allocator
rcutils_allocator_t allocator
allocator
Definition: shared_library.h:40
rcutils_ret_t
int rcutils_ret_t
The type that holds a return value for an rcutils operation.
Definition: rcutils_ret.h:26
RCUTILS_WARN_UNUSED
#define RCUTILS_WARN_UNUSED
A macro to make the compiler warn when the return value of a function is not used.
Definition: macros.h:27
rcutils_ret.h
visibility_control.h
rcutils_get_platform_library_name
rcutils_ret_t rcutils_get_platform_library_name(const char *library_name, char *library_name_platform, unsigned int buffer_size, bool debug)
Get the library name for the compiled platform.
rcutils_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:47
allocator.h
RCUTILS_PUBLIC
#define RCUTILS_PUBLIC
Definition: visibility_control.h:23
rcutils_load_shared_library
rcutils_ret_t rcutils_load_shared_library(rcutils_shared_library_t *lib, const char *library_path, rcutils_allocator_t allocator)
Return shared library pointer.
rcutils_is_shared_library_loaded
bool rcutils_is_shared_library_loaded(rcutils_shared_library_t *lib)
Check if the library is loaded.
rcutils_get_symbol
void * rcutils_get_symbol(const rcutils_shared_library_t *lib, const char *symbol_name)
Return shared library symbol pointer.