mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-16 21:10:10 +00:00
rfnoc: set UHD_API_HEADER on property_t
UHD_API sets the visibility for the symbols. Adding UHD_API fixes casting issues seen on macOS. However this breaks Windows because UHD_API sets __declspec(dllexport) and __declspec(dllimport) which doesn't make sense for header/inline only definitions. This change adds UHD_API_HEADER to denote entrypoints for this case. It sets the visibility flags for Linux/Mac but does not set the __declspec on Windows. Signed-off-by: Steven Koo <steven.koo@ni.com>
This commit is contained in:
parent
5ad27a59ec
commit
1b3ed2072e
3 changed files with 45 additions and 6 deletions
|
|
@ -24,6 +24,8 @@ typedef SSIZE_T ssize_t;
|
|||
#if defined(_MSC_VER)
|
||||
#define UHD_EXPORT __declspec(dllexport)
|
||||
#define UHD_IMPORT __declspec(dllimport)
|
||||
#define UHD_EXPORT_HEADER
|
||||
#define UHD_IMPORT_HEADER
|
||||
#define UHD_INLINE __forceinline
|
||||
#define UHD_DEPRECATED __declspec(deprecated)
|
||||
#define UHD_ALIGNED(x) __declspec(align(x))
|
||||
|
|
@ -31,6 +33,8 @@ typedef SSIZE_T ssize_t;
|
|||
#elif defined(__MINGW32__)
|
||||
#define UHD_EXPORT __declspec(dllexport)
|
||||
#define UHD_IMPORT __declspec(dllimport)
|
||||
#define UHD_EXPORT_HEADER
|
||||
#define UHD_IMPORT_HEADER
|
||||
#define UHD_INLINE inline
|
||||
#define UHD_DEPRECATED __declspec(deprecated)
|
||||
#define UHD_ALIGNED(x) __declspec(align(x))
|
||||
|
|
@ -38,6 +42,8 @@ typedef SSIZE_T ssize_t;
|
|||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define UHD_EXPORT __attribute__((visibility("default")))
|
||||
#define UHD_IMPORT __attribute__((visibility("default")))
|
||||
#define UHD_EXPORT_HEADER __attribute__((visibility("default")))
|
||||
#define UHD_IMPORT_HEADER __attribute__((visibility("default")))
|
||||
#define UHD_INLINE inline __attribute__((always_inline))
|
||||
#define UHD_DEPRECATED __attribute__((deprecated))
|
||||
#define UHD_ALIGNED(x) __attribute__((aligned(x)))
|
||||
|
|
@ -45,6 +51,8 @@ typedef SSIZE_T ssize_t;
|
|||
#elif defined(__clang__)
|
||||
#define UHD_EXPORT __attribute__((visibility("default")))
|
||||
#define UHD_IMPORT __attribute__((visibility("default")))
|
||||
#define UHD_EXPORT_HEADER __attribute__((visibility("default")))
|
||||
#define UHD_IMPORT_HEADER __attribute__((visibility("default")))
|
||||
#define UHD_INLINE inline __attribute__((always_inline))
|
||||
#define UHD_DEPRECATED __attribute__((deprecated))
|
||||
#define UHD_ALIGNED(x) __attribute__((aligned(x)))
|
||||
|
|
@ -52,22 +60,32 @@ typedef SSIZE_T ssize_t;
|
|||
#else
|
||||
#define UHD_EXPORT
|
||||
#define UHD_IMPORT
|
||||
#define UHD_EXPORT_HEADER
|
||||
#define UHD_IMPORT_HEADER
|
||||
#define UHD_INLINE inline
|
||||
#define UHD_DEPRECATED
|
||||
#define UHD_ALIGNED(x)
|
||||
#define UHD_UNUSED(x) x
|
||||
#endif
|
||||
|
||||
// API declaration macro
|
||||
|
||||
// Define API declaration macro
|
||||
//
|
||||
// UHD_API should be used for classes/structs that
|
||||
// have a direct cpp implementations that get directly
|
||||
// built into a so/dylib/dll.
|
||||
//
|
||||
// UHD_API_HEADER should be used for classes/structs
|
||||
// that are implemented in header only like hpp/ipp.
|
||||
#ifdef UHD_STATIC_LIB
|
||||
#define UHD_API
|
||||
#define UHD_API_HEADER
|
||||
#else
|
||||
#ifdef UHD_DLL_EXPORTS
|
||||
#define UHD_API UHD_EXPORT
|
||||
#define UHD_API_HEADER UHD_EXPORT_HEADER
|
||||
#else
|
||||
#define UHD_API UHD_IMPORT
|
||||
#define UHD_API_HEADER UHD_IMPORT_HEADER
|
||||
#endif // UHD_DLL_EXPORTS
|
||||
#endif // UHD_STATIC_LIB
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ typedef SSIZE_T ssize_t;
|
|||
#if defined(BOOST_MSVC)
|
||||
# define UHD_EXPORT __declspec(dllexport)
|
||||
# define UHD_IMPORT __declspec(dllimport)
|
||||
# define UHD_EXPORT_HEADER
|
||||
# define UHD_IMPORT_HEADER
|
||||
# define UHD_INLINE __forceinline
|
||||
# define UHD_FORCE_INLINE __forceinline
|
||||
# define UHD_DEPRECATED __declspec(deprecated)
|
||||
|
|
@ -61,6 +63,8 @@ typedef SSIZE_T ssize_t;
|
|||
#elif defined(__MINGW32__)
|
||||
# define UHD_EXPORT __declspec(dllexport)
|
||||
# define UHD_IMPORT __declspec(dllimport)
|
||||
# define UHD_EXPORT_HEADER
|
||||
# define UHD_IMPORT_HEADER
|
||||
# define UHD_INLINE inline
|
||||
# define UHD_FORCE_INLINE inline
|
||||
# define UHD_DEPRECATED __declspec(deprecated)
|
||||
|
|
@ -72,6 +76,8 @@ typedef SSIZE_T ssize_t;
|
|||
#elif defined(__GNUG__) && __GNUG__ >= 4
|
||||
# define UHD_EXPORT __attribute__((visibility("default")))
|
||||
# define UHD_IMPORT __attribute__((visibility("default")))
|
||||
# define UHD_EXPORT_HEADER __attribute__((visibility("default")))
|
||||
# define UHD_IMPORT_HEADER __attribute__((visibility("default")))
|
||||
# define UHD_INLINE inline __attribute__((always_inline))
|
||||
# define UHD_FORCE_INLINE inline __attribute__((always_inline))
|
||||
# define UHD_DEPRECATED __attribute__((deprecated))
|
||||
|
|
@ -87,6 +93,8 @@ typedef SSIZE_T ssize_t;
|
|||
#elif defined(__clang__)
|
||||
# define UHD_EXPORT __attribute__((visibility("default")))
|
||||
# define UHD_IMPORT __attribute__((visibility("default")))
|
||||
# define UHD_EXPORT_HEADER __attribute__((visibility("default")))
|
||||
# define UHD_IMPORT_HEADER __attribute__((visibility("default")))
|
||||
# define UHD_INLINE inline __attribute__((always_inline))
|
||||
# define UHD_FORCE_INLINE inline __attribute__((always_inline))
|
||||
# define UHD_DEPRECATED __attribute__((deprecated))
|
||||
|
|
@ -102,6 +110,8 @@ typedef SSIZE_T ssize_t;
|
|||
#else
|
||||
# define UHD_EXPORT
|
||||
# define UHD_IMPORT
|
||||
# define UHD_EXPORT_HEADER
|
||||
# define UHD_IMPORT_HEADER
|
||||
# define UHD_INLINE inline
|
||||
# define UHD_FORCE_INLINE inline
|
||||
# define UHD_DEPRECATED
|
||||
|
|
@ -113,13 +123,23 @@ typedef SSIZE_T ssize_t;
|
|||
#endif
|
||||
|
||||
// Define API declaration macro
|
||||
//
|
||||
// UHD_API should be used for classes/structs that
|
||||
// have a direct cpp implementations that get directly
|
||||
// built into a so/dylib/dll.
|
||||
//
|
||||
// UHD_API_HEADER should be used for classes/structs
|
||||
// that are implemented in header only like hpp/ipp.
|
||||
#ifdef UHD_STATIC_LIB
|
||||
# define UHD_API
|
||||
# define UHD_API_HEADER
|
||||
#else
|
||||
# ifdef UHD_DLL_EXPORTS
|
||||
# define UHD_API UHD_EXPORT
|
||||
# define UHD_API_HEADER UHD_EXPORT_HEADER
|
||||
# else
|
||||
# define UHD_API UHD_IMPORT
|
||||
# define UHD_API_HEADER UHD_IMPORT_HEADER
|
||||
# endif // UHD_DLL_EXPORTS
|
||||
#endif // UHD_STATIC_LIB
|
||||
|
||||
|
|
|
|||
|
|
@ -36,14 +36,15 @@ public:
|
|||
property_base_t(const std::string& id, const res_source_info& source_info)
|
||||
: _id(id), _source_info(source_info)
|
||||
{
|
||||
if(_id.find(':') != std::string::npos) {
|
||||
throw uhd::value_error("Property ID `" + _id + "' contains invalid character!");
|
||||
if (_id.find(':') != std::string::npos) {
|
||||
throw uhd::value_error(
|
||||
"Property ID `" + _id + "' contains invalid character!");
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~property_base_t()
|
||||
{
|
||||
//nop
|
||||
// nop
|
||||
}
|
||||
|
||||
//! Gets the ID (name) of this property
|
||||
|
|
@ -146,7 +147,7 @@ private:
|
|||
* An encapsulation class for a block property.
|
||||
*/
|
||||
template <typename data_t>
|
||||
class property_t : public property_base_t
|
||||
class UHD_API_HEADER property_t : public property_base_t
|
||||
{
|
||||
public:
|
||||
//! We want to be good C++ citizens
|
||||
|
|
|
|||
Loading…
Reference in a new issue