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

Commit

Permalink
Merge pull request #14 from flibitijibibo/master
Browse files Browse the repository at this point in the history
include: Add support for C compilation
  • Loading branch information
misyltoad authored Apr 19, 2022
2 parents a2dc99c + 5800044 commit f41a8f5
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 f41a8f5

Please sign in to comment.