]> localhost Git - pldh.git/commitdiff
Use decltype with C++
authormisomosi <[email protected]>
Tue, 7 May 2024 04:51:16 +0000 (00:51 -0400)
committermisomosi <[email protected]>
Tue, 7 May 2024 04:54:44 +0000 (00:54 -0400)
pld.h

diff --git a/pld.h b/pld.h
index 52ebbe61de4a85beb3c611bba2e993b43b1a613f..706865327b78e9c5e920c50e8aeebfae51b3abde 100644 (file)
--- a/pld.h
+++ b/pld.h
@@ -6,7 +6,9 @@
 #define _GNU_SOURCE\r
 #endif\r
 \r
-#ifdef _MSC_VER\r
+#if defined(__cplusplus)\r
+#define PLDTYPEOF(x) decltype(x)\r
+#elif defined(_MSC_VER)\r
 #define PLDTYPEOF(x) __typeof__(x)\r
 #else\r
 #define PLDTYPEOF(x) typeof(x)\r
@@ -199,7 +201,7 @@ static PLD_LibHandle PLD_Private_dlopen_wrapper(const char *name)
 \r
 \r
 #define PLD(name) \\r
-       PLD_LibHandle PLDH(void) { \\r
+       static PLD_LibHandle PLDH(void) { \\r
                static PLD_LibHandle handle = NULL; \\r
                if (handle == NULL) handle = PLD_Private_dlopen_wrapper(name); \\r
                return handle; \\r