From: misomosi Date: Tue, 7 May 2024 04:51:16 +0000 (-0400) Subject: Use decltype with C++ X-Git-Url: http://git.misomosispi.com/?a=commitdiff_plain;h=a34d16272379a1aec769a4b6bceebce7487e1954;p=pldh.git Use decltype with C++ --- diff --git a/pld.h b/pld.h index 52ebbe6..7068653 100644 --- a/pld.h +++ b/pld.h @@ -6,7 +6,9 @@ #define _GNU_SOURCE #endif -#ifdef _MSC_VER +#if defined(__cplusplus) +#define PLDTYPEOF(x) decltype(x) +#elif defined(_MSC_VER) #define PLDTYPEOF(x) __typeof__(x) #else #define PLDTYPEOF(x) typeof(x) @@ -199,7 +201,7 @@ static PLD_LibHandle PLD_Private_dlopen_wrapper(const char *name) #define PLD(name) \ - PLD_LibHandle PLDH(void) { \ + static PLD_LibHandle PLDH(void) { \ static PLD_LibHandle handle = NULL; \ if (handle == NULL) handle = PLD_Private_dlopen_wrapper(name); \ return handle; \