Skip to content

Commit 73fffd9

Browse files
committed
Fix build in C++ mode
Note that StringFromCLSID() calls StringFromGUID2(), the first parameter of which is a REFGUID, which is defined differently under C++ compared to C! From Guiddef.h: #ifdef __cplusplus #define REFGUID const GUID & #else #define REFGUID const GUID * __MIDL_CONST #endif (Based on a patch from Daniel Dragan on perl5-porters: http://code.activestate.com/lists/perl5-porters/217113/)
1 parent 646149f commit 73fffd9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Win32.xs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ get_unicode_env(pTHX_ WCHAR *name)
236236
pfnCreateEnvironmentBlock(&env, token, FALSE))
237237
{
238238
size_t name_len = wcslen(name);
239-
WCHAR *entry = env;
239+
WCHAR *entry = (WCHAR *)env;
240240
while (*entry) {
241241
size_t i;
242242
size_t entry_len = wcslen(entry);
@@ -817,7 +817,11 @@ XS(w32_GuidGen)
817817

818818
if (SUCCEEDED(hr)) {
819819
LPOLESTR pStr = NULL;
820+
#ifdef __cplusplus
821+
if (SUCCEEDED(StringFromCLSID(guid, &pStr))) {
822+
#else
820823
if (SUCCEEDED(StringFromCLSID(&guid, &pStr))) {
824+
#endif
821825
WideCharToMultiByte(CP_ACP, 0, pStr, (int)wcslen(pStr), szGUID,
822826
sizeof(szGUID), NULL, NULL);
823827
CoTaskMemFree(pStr);

0 commit comments

Comments
 (0)