-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Sample for IDynamicInterfaceCastable
#3744
Conversation
|
||
This sample provides an implementation of `IDynamicInterfaceCastable` that projects a native object as implementing different known managed interfaces. It uses COM conventions (e.g. `QueryInterface`) for interacting with the native object, but does not require the actual COM system. | ||
|
||
Note: The sample uses `Marshal` APIs as part of interacting with the native library. The introduction of [C# function pointers](https://github.com/dotnet/csharplang/blob/994c41586e07e38fb6b30902b1715b4025d80c52/proposals/function-pointers.md) will allow that interaction to occur in a more performant manner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function pointers are shipping in previews already. Can the sample be modified to use them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new syntax for specifying the calling convention (e.g. cdecl
-> unmanaged[Cdecl]
) isn't in the shipped previews yet. I was planning on updating the sample once they can use the new syntax.
Co-authored-by: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
@dotnet/docs This sample involves building a native library. To make it a bit simpler for users to run, it hooks the native build in such that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some nits for the C# bits, otherwise this is looking awesome!
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/NativeObject.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/NativeObject.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
core/interop/IDynamicInterfaceCastable/src/ManagedApp/Program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: David Pine <david.pine@microsoft.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
de58b63
to
aed057e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually needs a README.md with metadata, so that it is indexed by the samples browser.
Here is an example:
https://github.com/dotnet/samples/blob/master/async/async-and-await/cs/readme.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a README.md
I would love to get CI working for this. I checked on my computer that has the latest VS2019 preview and I don't have the following according to the readme:
|
Nice - I had no idea that was a thing. Will update.
Do you have a C++ workload installed for VS? I'll make the readme point out The CI is only on Windows currently, right? |
Ahh that is probably the reason. I believe the CI machine has all workloads installed, so the command would work there. CI is only on Windows yes. Tomorrow I'll work on getting Preview 7 installed and the CI to use dotnet via the developer command prompt. It currently only runs it directly. |
@adegeo I updated the sample so that it should automatically find the MSVC compiler based on the bitness of the |
dec24ce
to
e7a5943
Compare
Awesome! CI passed! |
Co-authored-by: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
@IEvangelist I have updated the README to include metadata for indexing by the samples browser. Do you have any additional concerns with this? |
Co-authored-by: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
@adegeo Seems like the CI is now expecting the added
When it was passing before, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, we'll - thank you 🙏
Summary
Add a sample using the new
IDynamicInterfaceCastable
API.cc @AaronRobinsonMSFT @jkoritzinsky