diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-05 19:08:10 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-05 19:08:10 +0200 |
commit | f8a92529ec04b560b5b9e647b976892412f78134 (patch) | |
tree | 5308d7f500df46ef64423708ed40a37675f4020c /include/sqfs/predef.h | |
parent | 320ae4f8e752f6652c7b5c8201d7267cd4de17c1 (diff) |
Fix API visibility for libsquashfs.so
This commit adds a "predef.h" header to libsquashfs that exposes two
macros, SQFS_API and SQFS_INTERNAL that are used to explicilty set
the visibiliy of stuff that ends up in libsquashfs to default or
hidden.
For compatibillity with Windows which may at some point eventually be
considered, the SQFS_API define is set to dllexport IF the cpp symbol
SQFS_BUILDING_DLL is defined and set to import otherwise.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs/predef.h')
-rw-r--r-- | include/sqfs/predef.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/sqfs/predef.h b/include/sqfs/predef.h new file mode 100644 index 0000000..210f306 --- /dev/null +++ b/include/sqfs/predef.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * predef.h + * + * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> + */ +#ifndef SQFS_PREDEF_H +#define SQFS_PREDEF_H + +#if defined(_WIN32) || defined(__CYGWIN__) + #ifdef SQFS_BUILDING_DLL + #if defined(__GNUC__) || defined(__clang__) + #define SQFS_API __attribute__ ((dllexport)) + #else + #define SQFS_API __declspec(dllexport) + #endif + #else + #if defined(__GNUC__) || defined(__clang__) + #define SQFS_API __attribute__ ((dllimport)) + #else + #define SQFS_API __declspec(dllimport) + #endif + #endif + + #define SQFS_INTERNAL +#else + #if defined(__GNUC__) || defined(__clang__) + #define SQFS_API __attribute__ ((visibility ("default"))) + #define SQFS_INTERNAL __attribute__ ((visibility ("hidden"))) + #else + #define SQFS_API + #define SQFS_INTERNAL + #endif +#endif + +#endif /* SQFS_PREDEF_H */ |