From 9566e8af25f87ad034a984db9d847942e454a180 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 25 Jul 2022 10:08:28 -0700 Subject: Allow `class` to implement COM interface, [DLLExport] (#2338) * Allow `class` to implement COM interface, [DLLExport] * Fix [COM] usage in tests and examples with UUIDs. Co-authored-by: Yong He --- prelude/slang-cpp-prelude.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'prelude') diff --git a/prelude/slang-cpp-prelude.h b/prelude/slang-cpp-prelude.h index 0381a7bb6..a91019d15 100644 --- a/prelude/slang-cpp-prelude.h +++ b/prelude/slang-cpp-prelude.h @@ -40,6 +40,8 @@ #endif #define SLANG_PRELUDE_EXPORT SLANG_PRELUDE_EXTERN_C SLANG_PRELUDE_SHARED_LIB_EXPORT +#define SLANG_PRELUDE_EXPORT_START SLANG_PRELUDE_EXTERN_C_START SLANG_PRELUDE_SHARED_LIB_EXPORT +#define SLANG_PRELUDE_EXPORT_END SLANG_PRELUDE_EXTERN_C_END SLANG_PRELUDE_SHARED_LIB_EXPORT #ifndef SLANG_INFINITY # define SLANG_INFINITY INFINITY @@ -272,6 +274,13 @@ struct ISlangUnknown virtual SLANG_NO_THROW uint32_t SLANG_MCALL release() = 0; }; +#define SLANG_COM_INTERFACE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ + public: \ + SLANG_FORCE_INLINE static const SlangUUID& getTypeGuid() \ + { \ + static const SlangUUID guid = { a, b, c, d0, d1, d2, d3, d4, d5, d6, d7 }; \ + return guid; \ + } #endif // SLANG_H // Includes @@ -288,4 +297,4 @@ struct ISlangUnknown # define SLANG_UNROLL #endif -#endif \ No newline at end of file +#endif -- cgit v1.2.3