mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
Common (Windows): allows COM be used in C sources
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "com.hpp"
|
||||
#include "com.h"
|
||||
|
||||
#include <roapi.h>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "common/attributes.h"
|
||||
#include <unknwn.h>
|
||||
#include "common/attributes.h"
|
||||
#include <assert.h>
|
||||
#include <unknwn.h>
|
||||
|
||||
// Initialize COM & WinRT
|
||||
const char* ffInitCom(void);
|
||||
|
||||
static inline void ffReleaseComObject(void* ppUnknown) {
|
||||
assert(ppUnknown);
|
||||
IUnknown* pUnknown = *(IUnknown**) ppUnknown;
|
||||
if (pUnknown) {
|
||||
#ifdef __cplusplus
|
||||
pUnknown->Release();
|
||||
#else
|
||||
pUnknown->lpVtbl->Release(pUnknown);
|
||||
#endif
|
||||
*(IUnknown**) ppUnknown = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define FF_AUTO_RELEASE_COM_OBJECT FF_A_CLEANUP(ffReleaseComObject)
|
||||
|
||||
#else
|
||||
// Win32 COM headers requires C++ compiler
|
||||
#error Must be included in C++ source file
|
||||
#endif
|
||||
#define FF_AUTO_RELEASE_COM_OBJECT FF_A_CLEANUP(ffReleaseComObject)
|
||||
Reference in New Issue
Block a user