Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion strings/base_marshaler.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

WINRT_EXPORT namespace winrt::impl
namespace winrt::impl
{
inline std::int32_t make_marshaler(unknown_abi* outer, void** result) noexcept
{
Expand Down
24 changes: 24 additions & 0 deletions test/test_cpp20_module/marshal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "pch.h"
#include <objidl.h>

import std;
import winrt.Windows.Foundation.Collections;

using namespace winrt;

struct S : implements<S, Windows::Foundation::IStringable>
{
hstring ToString()
{
return L"S";
}
};

// When winrt::impl::get_marshaler was being exported, an MSVC bug caused the marshaler
// object to have a null vtable, which caused a crash when calling any method on the marshaler.
// This test ensures that the marshaler vtable is properly initialized.
TEST_CASE("IMarshal")
{
auto s = make<S>();
auto marshal = s.as<IMarshal>();
}
4 changes: 3 additions & 1 deletion test/test_cpp20_module/test_cpp20_module.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup> <PropertyGroup Label="Globals">
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{B8E3A5CE-4E91-4F27-9B02-E0CAF7E10D72}</ProjectGuid>
<RootNamespace>test_cpp20_module</RootNamespace>
Expand Down Expand Up @@ -91,6 +92,7 @@
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="marshal.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
Expand Down
Loading