Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No documentation on usage of wil::register_com_server #484

Open
shmuelie opened this issue Nov 7, 2024 · 3 comments
Open

No documentation on usage of wil::register_com_server #484

shmuelie opened this issue Nov 7, 2024 · 3 comments
Labels
documentation Incorrect/missing documentation

Comments

@shmuelie
Copy link

shmuelie commented Nov 7, 2024

#440 add the wil:register_com_server helpers, but the wiki was not updated with any docs on usage.

@sylveon
Copy link
Contributor

sylveon commented Nov 7, 2024

@roxk

@roxk
Copy link
Contributor

roxk commented Nov 18, 2024

I'm extremely busy with personal work so I won't be able to add docs soon. In the mean time, @shmuelie please reference relevant tests (e.g. in https://github.com/microsoft/wil/blob/master/tests/CppWinRTComServerTests.cpp#L60) and the original proposal.

Minimal server code snippet for the lazy:

// main.cpp
wil::unique_event _comExitEvent;

void notifier()
{
  _comExitEvent.SetEvent();
}

int main()
{
  _comExitEvent.create();
  wil::notifiable_module_lock::instance().set_notifier(notifier);
  winrt::init_apartment();
  // Make sure the created instance isn't destroyed immediately for RAII to work
  auto revoker = wil::register_com_server<MyServer>();
  _comExitEvent.wait();
  return 0;
}

@shmuelie
Copy link
Author

@roxk that's what I've been working with for now 😅

@dunhor dunhor added the documentation Incorrect/missing documentation label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Incorrect/missing documentation
Projects
None yet
Development

No branches or pull requests

4 participants