Skip to content

Commit bc8b5c9

Browse files
committed
c/hv.h: Define MOOCORE_API based on MOOCORE_STATIC_LIB and MOOCORE_SHARED_LIB.
1 parent 13e9521 commit bc8b5c9

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

c/hv.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,29 @@
2020
#ifndef HV_H_
2121
#define HV_H_
2222

23-
#ifdef __cplusplus
23+
#if !defined(MOOCORE_STATIC_LIB) && (defined(_MSC_VER) || defined(_WIN32) || defined(__CYGWIN__))
24+
# ifdef MOOCORE_SHARED_LIB
25+
# define MOOCORE_API __declspec(dllexport) extern
26+
# else
27+
# define MOOCORE_API __declspec(dllimport) extern
28+
# endif
29+
#elif __GNUC__ >= 4 && defined(__cplusplus)
30+
# define MOOCORE_API __attribute__((visibility("default"))) extern
31+
#endif
32+
33+
#ifndef MOOCORE_API
34+
# define MOOCORE_API extern
35+
#endif
36+
37+
// C++ needs to know that types and declarations are C, not C++.
38+
#ifdef __cplusplus
2439
extern "C" {
2540
#endif
2641

27-
double fpli_hv(const double *data, int d, int n, const double *ref);
28-
void hv_contributions (double *hvc, double *points, int dim, int size, const double * ref);
29-
#ifdef __cplusplus
42+
MOOCORE_API double fpli_hv(const double *data, int d, int n, const double *ref);
43+
MOOCORE_API void hv_contributions (double *hvc, double *points, int dim, int size, const double * ref);
44+
45+
#ifdef __cplusplus
3046
}
3147
#endif
3248

0 commit comments

Comments
 (0)