diff --git a/hcore/include/senseApis/senseApiLib.h b/hcore/include/senseApis/senseApiLib.h index d50918e..4bf1b61 100644 --- a/hcore/include/senseApis/senseApiLib.h +++ b/hcore/include/senseApis/senseApiLib.h @@ -27,7 +27,8 @@ private: public: SenseApiLib( - const std::string& path, void *_dlopen_handle, getSenseApiDescFn *descFn) + const std::string& path, void *_dlopen_handle, + HK_GET_SENSE_API_DESC_FN_TYPEDEF *descFn) : libraryPath(path), dlopen_handle(_dlopen_handle, DlCloser()), HK_GET_SENSE_API_DESC_FN_NAME(descFn) @@ -61,7 +62,8 @@ public: * This getter function should be visible to dlsym() so that Harikoff can * find it in the lib after loading it, and call it. */ - std::function HK_GET_SENSE_API_DESC_FN_NAME; + std::function + HK_GET_SENSE_API_DESC_FN_NAME; /** * @brief Harikoff will call the `HK_GET_SENSE_API_DESC_FN_NAME` getter diff --git a/hcore/senseApis/senseApiManager.cpp b/hcore/senseApis/senseApiManager.cpp index 7d95738..8cae27a 100644 --- a/hcore/senseApis/senseApiManager.cpp +++ b/hcore/senseApis/senseApiManager.cpp @@ -92,7 +92,7 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(const std::string& libraryPath) } // Initialize getSenseApiDescriptor - auto func = reinterpret_cast( + auto func = reinterpret_cast( dlsym(dlopen_handle.get(), HK_GET_SENSE_API_DESC_FN_NAME_STR)); if (!func) { diff --git a/include/preprocessor.h b/include/preprocessor.h index cd9166f..bf0d400 100644 --- a/include/preprocessor.h +++ b/include/preprocessor.h @@ -4,6 +4,8 @@ #define HK_Q(x) #x #define HK_QUOTE(x) HK_Q(x) +#define HK_CONCAT(a, b) a ## b + #define HK_UNMANGLED "C" #endif // HK_PREPROCESSOR_H diff --git a/include/user/senseApiDesc.h b/include/user/senseApiDesc.h index a3987a5..9f825ef 100644 --- a/include/user/senseApiDesc.h +++ b/include/user/senseApiDesc.h @@ -121,8 +121,10 @@ public: #define HK_GET_SENSE_API_DESC_FN_NAME getSenseApiDesc #define HK_GET_SENSE_API_DESC_FN_NAME_STR \ HK_QUOTE(HK_GET_SENSE_API_DESC_FN_NAME) +#define HK_GET_SENSE_API_DESC_FN_TYPEDEF \ + HK_CONCAT(HK_GET_SENSE_API_DESC_FN_NAME, Fn) -typedef const SenseApiDesc &(getSenseApiDescFn)(void); +typedef const SenseApiDesc &(HK_GET_SENSE_API_DESC_FN_TYPEDEF)(void); } // namespace sense_api } // namespace hk diff --git a/senseApis/xcbXorg/xcbXorg.cpp b/senseApis/xcbXorg/xcbXorg.cpp index e34fefa..cb159d8 100644 --- a/senseApis/xcbXorg/xcbXorg.cpp +++ b/senseApis/xcbXorg/xcbXorg.cpp @@ -459,7 +459,7 @@ static hk::sense_api::SenseApiDesc xcbXorgApiDesc = * * @return A reference to the SenseApiDesc structure describing the API. */ -extern HK_UNMANGLED hk::sense_api::getSenseApiDescFn +extern HK_UNMANGLED hk::sense_api::HK_GET_SENSE_API_DESC_FN_TYPEDEF HK_GET_SENSE_API_DESC_FN_NAME; const hk::sense_api::SenseApiDesc &HK_GET_SENSE_API_DESC_FN_NAME(void)