-
Notifications
You must be signed in to change notification settings - Fork 54
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
Unable to make it work in pure C (com_ptr is apparently mandatory but it should not be) #1124
Comments
I guess you forget add reference to
|
Finally. It makes so much sense. I am tired, my mistake. But honestly, finally someone that actually looked on my code a bit and came with the solution. I had a thread on StackOverflow, everyone was commenting with generics but no one was actually looking a bit on the particular case. A million thanks for taking the time, and apologies to the team for mislabeling this as a bug. |
And you don't need to alloc |
Indeed, you are right. Never quite did this, haven't thought of it, but, again, it makes too much sense. I ended up with forward declaring my
Thank you very much for your tips. It helps improve my C skill and understand from top to bottom, that's the main reason I write this example in C. Thank you. |
@valinet Hello! Could you please provide the final complete version of this example? I am trying to use WebView2 in Kotlin/Native. But I am a C/C++ beginner and it is difficult for me to understand this code. |
Description
I cannot make the library work in a pure C project despite the package description on NuGet saying "This package is necessary for Win32 C/C++ applications." and the documentation stating "The Windows Implementation Library and Windows Runtime C++ Template Library are optional and make working with COM easier for the example.".
Version
SDK: 1.0.774.44
Runtime: 89.0.774.63
Framework: Win32
OS: Windows 10 Version 20H2 (OS Build 19042.867)
Repro Steps
Take the example from https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/win32:
And compile it as a C++ file. It works fine. Now, replace the
com_ptr
s with regular pointers. So, from:To this:
Compile as C++ again. It does not work, the WebView2 never appears on the window. This is probably the cause I am unable to make a C port of the C++ example above work too. COM calls work just fine (the callbacks) apparently, but similarly, the WebView2 is never added to the window.
So, it seems to me that
com_ptr
is somehow required despite that it shouldn't be so. Furthermore, this library should work from C too, I can see no reason why it wouldn't.Here is the C port of the code above that I am trying to get working:
The text was updated successfully, but these errors were encountered: