Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
include: Add support for C compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Apr 17, 2022
1 parent a2dc99c commit 5800044
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 116 deletions.
30 changes: 30 additions & 0 deletions include/native/windows/unknwn.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

#include "windows_base.h"

typedef interface IUnknown IUnknown;

DEFINE_GUID(IID_IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46)

#ifdef __cplusplus
struct IUnknown {

public:
Expand All @@ -13,6 +17,32 @@ struct IUnknown {
virtual ULONG Release() = 0;

};
#else
typedef struct IUnknownVtbl
{
BEGIN_INTERFACE

HRESULT (STDMETHODCALLTYPE *QueryInterface)(
IUnknown *This,
REFIID riid,
void **ppvObject
);
ULONG (STDMETHODCALLTYPE *AddRef)(IUnknown *This);
ULONG (STDMETHODCALLTYPE *Release)(IUnknown *This);

END_INTERFACE
} IUnknownVtbl;

interface IUnknown
{
CONST_VTBL struct IUnknownVtbl *lpVtbl;
};

#define IUnknown_AddRef(This) ((This)->lpVtbl->AddRef(This))
#define IUnknown_Release(This) ((This)->lpVtbl->Release(This))

#endif // __cplusplus

DECLARE_UUIDOF_HELPER(IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46)

#define IID_PPV_ARGS(ppType) __uuidof(decltype(**(ppType))), [](auto** pp) { (void)static_cast<IUnknown*>(*pp); return reinterpret_cast<void**>(pp); }(ppType)
Loading

0 comments on commit 5800044

Please sign in to comment.