hedley icon indicating copy to clipboard operation
hedley copied to clipboard

HEDLEY_IMPORT with C++ classes

Open mattyclarkson opened this issue 6 years ago • 4 comments

HEDLEY_IMPORT is specificed as extern which fails when used as so:

#ifdef PROJECT_COMPILATION
#define PROJECT_API HEDLEY_PUBLIC
#else
#define PROJECT_API HEDLEY_IMPORT
#endif

class PROJECT_API example {};

We would expect that example symbols are exported. However, when importing the result is class extern example {}; which is invalid.

A possible solution is:

#ifdef __cplusplus
#define HEDLEY_IMPORT
#else
#define HEDLEY_IMPORT extern
#endif

mattyclarkson avatar Mar 26 '20 11:03 mattyclarkson

@nemequ do you have any thoughts on this?

mattyclarkson avatar Dec 13 '21 15:12 mattyclarkson