diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-shared-library.cpp | 16 | ||||
| -rw-r--r-- | source/core/slang-shared-library.h | 8 |
2 files changed, 20 insertions, 4 deletions
diff --git a/source/core/slang-shared-library.cpp b/source/core/slang-shared-library.cpp index 17b881540..844bea8d9 100644 --- a/source/core/slang-shared-library.cpp +++ b/source/core/slang-shared-library.cpp @@ -76,9 +76,21 @@ TemporarySharedLibrary::~TemporarySharedLibrary() /* !!!!!!!!!!!!!!!!!!!!!!!!!! DefaultSharedLibrary !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ -ISlangUnknown* DefaultSharedLibrary::getInterface(const Guid& guid) +SLANG_NO_THROW SlangResult SLANG_MCALL DefaultSharedLibrary::queryInterface(SlangUUID const& uuid, void** outObject) { - return (guid == ISlangUnknown::getTypeGuid() || guid == ISlangSharedLibrary::getTypeGuid()) ? static_cast<ISlangSharedLibrary*>(this) : nullptr; + if (uuid == DefaultSharedLibrary::getTypeGuid()) + { + *outObject = this; + return SLANG_OK; + } + + if (uuid == ISlangUnknown::getTypeGuid() || uuid == ISlangSharedLibrary::getTypeGuid()) + { + addReference(); + *outObject = static_cast<ISlangSharedLibrary*>(this); + return SLANG_OK; + } + return SLANG_E_NO_INTERFACE; } DefaultSharedLibrary::~DefaultSharedLibrary() diff --git a/source/core/slang-shared-library.h b/source/core/slang-shared-library.h index c33f1f41b..452379d68 100644 --- a/source/core/slang-shared-library.h +++ b/source/core/slang-shared-library.h @@ -48,9 +48,13 @@ private: class DefaultSharedLibrary : public ISlangSharedLibrary, public RefObject { public: - // ISlangUnknown - SLANG_REF_OBJECT_IUNKNOWN_ALL + SLANG_CLASS_GUID(0xe7f2597b, 0xf803, 0x4b6e, { 0xaf, 0x8b, 0xcb, 0xe3, 0xa2, 0x21, 0xfd, 0x5a }) + // ISlangUnknown + virtual SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject) SLANG_OVERRIDE; + SLANG_REF_OBJECT_IUNKNOWN_ADD_REF + SLANG_REF_OBJECT_IUNKNOWN_RELEASE + // ISlangSharedLibrary virtual SLANG_NO_THROW void* SLANG_MCALL findSymbolAddressByName(char const* name) SLANG_OVERRIDE; |
