зеркало из https://github.com/microsoft/cppwinrt.git
Explain how to use static libraries.
This commit is contained in:
Родитель
fb3989cd7b
Коммит
2e26492881
|
@ -5,8 +5,29 @@
|
|||
This project demonstrates how to get started authoring Windows Runtime
|
||||
classes directly with standard C++, using the C++/WinRT SDK component
|
||||
to generate implementation headers from interface (IDL) files. The
|
||||
generated Windows Runtime component binary and WinMD files should then
|
||||
be bundled with the Universal Windows Platform (UWP) app consuming them.
|
||||
generated static library should be consumed by a single Runtime Component
|
||||
or App project and the and types will automatically be added to that
|
||||
binary.
|
||||
To be able to instantiate types from the static library you need to
|
||||
update the activation factory in the consuming binary to call the
|
||||
activation factory exposed by this static library using code similar to:
|
||||
|
||||
void* __stdcall $projectname$_get_activation_factory(
|
||||
std::wstring_view const& name);
|
||||
|
||||
void* __stdcall winrt_get_activation_factory(
|
||||
std::wstring_view const& name)
|
||||
{
|
||||
void* factory = $projectname$_get_activation_factory(name);
|
||||
if (factory)
|
||||
{
|
||||
return factory;
|
||||
}
|
||||
|
||||
/* call other activation factories */
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Steps:
|
||||
1. Create an interface (IDL) file to define your Windows Runtime class,
|
||||
|
|
Загрузка…
Ссылка в новой задаче