Hide visibility of sinqController classes
All checks were successful
Test And Build / Lint (push) Successful in 5s
Test And Build / Build (push) Successful in 6s

This commit is contained in:
2025-08-12 08:51:54 +02:00
parent 4d27783062
commit c19e4845e4
4 changed files with 34 additions and 6 deletions

View File

@@ -309,4 +309,16 @@ If your driver uses another driver as a static dependency via git submodule whic
- `git commit -m "Update turboPmac to 1.0"`
- `git submodule update --init --recursive`
This will update sinqMotor to the version specified in the 1.0 commit of turboPmac.
This will update sinqMotor to the version specified in the 1.0 commit of turboPmac.
### Exporting symbols
By default, the symbols of classes and functions are hidden to avoid symbol clashes when loading
multiple shared libraries which use `sinqMotor`. In order to compile this library with exported
symbols, specifiy `-DHIDDEN= ` as a compiler flag (if using the given Makefile, this
needs to be added to the `USR_CFLAGS`).
Derived libraries can use the same mechanism via the macro `HIDDEN` (defined in `msgPrintControl.h`):
```
class HIDDEN turboPmacController : public sinqController
```

View File

@@ -10,12 +10,27 @@
#include <string>
#include <unordered_map>
/*
The macro "HIDDEN" hides the symbol of the annotated class / function. This is
useful to avoid symbol clashes when loading multiple shared libraries in a
single IOC. To override the hiding, add `-DHIDDEN= ` to your compiler
flags (in this case, the symbols will be exported with their default
visibility).
*/
#ifndef HIDDEN
#if defined(_WIN32) || defined(__CYGWIN__)
#define HIDDEN
#else
#define HIDDEN __attribute__((visibility("hidden")))
#endif
#endif
/**
* @brief Class to identify a message print location. See the docstring of
* `msgPrintControl` on how to use this key.
*
*/
class msgPrintControlKey {
class HIDDEN msgPrintControlKey {
public:
std::string controller_;
@@ -82,7 +97,7 @@ template <> struct hash<msgPrintControlKey> {
* }
* ```
*/
class msgPrintControl {
class HIDDEN msgPrintControl {
public:
/**
* @brief Destroy the msgPrintControl object

View File

@@ -9,12 +9,13 @@ Stefan Mathis, November 2024
#ifndef sinqAxis_H
#define sinqAxis_H
#include "asynMotorAxis.h"
#include "msgPrintControl.h"
#include <memory>
#include <type_traits>
struct sinqAxisImpl;
class epicsShareClass sinqAxis : public asynMotorAxis {
class HIDDEN sinqAxis : public asynMotorAxis {
public:
/**
* @brief Construct a new sinqAxis object

View File

@@ -20,9 +20,9 @@ Stefan Mathis, November 2024
#define AbsoluteEncoder "absolute"
#define NoEncoder "none"
struct sinqControllerImpl;
struct HIDDEN sinqControllerImpl;
class epicsShareClass sinqController : public asynMotorController {
class HIDDEN sinqController : public asynMotorController {
public:
/**
* @brief Construct a new sinqController object