#Pinvoke
Made a thing this weekend, helps test and validate Struct Memory Layouts in C# Interop. Using Snapshot testing! github.com/Yellow-Dog-M...
GitHub - Yellow-Dog-Man/Verify.Marshaling: Verify your Struct Memory Layouts for Interop/PInvoke with VerifyTests
Verify your Struct Memory Layouts for Interop/PInvoke with VerifyTests - Yellow-Dog-Man/Verify.Marshaling
github.com
July 7, 2025 at 4:39 AM
took some time yesterday to start migrating my engine’s physics system to box2d v3 and got all the c# bindings generating! #gamedev #zinc

github.com/zinc-framewo...
Zinc.Bindings/box2d/Box2D.cs at main · zinc-framework/Zinc.Bindings
pinvoke bindings for dependent zinc libs. Contribute to zinc-framework/Zinc.Bindings development by creating an account on GitHub.
github.com
November 17, 2024 at 2:36 PM
okay, long shot but: is there any way to pinvoke into objective-c without building a little translation layer .dylib?

I want to open a native file chooser dialog on MacOS (presumably NSOpenPanel) from a Unity game (on Steam), without needing to build/ship a dylib shim.
December 12, 2024 at 10:34 AM
Yeah, that one would be high on the blocklist:
- Dynamic C#
- PInvoke
- kernell32.dll
- LoadLibrary method
Lots of flags there. When possible, I try to do a hybrid module instead and ship the C#-bits as a DLL file. Does the same thing, but not under the "PowerShell is evil" filters.
December 17, 2024 at 11:06 AM
Docs update!

The topic "Build a C# NET app with WinUI 3 and Win32 interop" has been updated to reference the recommended cswin32 helper library.

#WindowsDev
#WinUI

https://msft.it/63326qVjxm
Build a C# .NET app with WinUI 3 and Win32 interop - Windows apps
Build a C# .NET application with WinUI 3 and basic Win32 interop capabilities using the Platform Invocation Services, or PInvoke.
msft.it
March 17, 2025 at 6:49 PM
I got it on windows (C# COM to create IFileOpenDialog) and linux (pinvoke into gtk3, which has a shim shipped by Steam for cross-distro support), and it'd be suuuper cool to also have a "pure" C# solution for macos, but I'm losing hope
December 12, 2024 at 10:34 AM
There was apparently an update to user32.dll recently in #Win11 and you can no longer forward the wm_input message to a different process because you will get an invalid handle error if you try to read from it. I have no idea if that was intentional but it broke things. #Windows #Pinvoke
January 23, 2025 at 9:57 PM
🧩 What if PowerShell needs to go beyond cmdlets?

@leodarcy.bsky.social shows how to call Windows APIs with pInvoke, covering system calls, VPN profiles, Group Policy notifications, display enumeration, and unmanaged memory. 👉 youtu.be/f2aDkxiUNbA?si=L3X...

#PowerShell #Win32 #PSConfEU
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
youtu.be
August 7, 2026 at 11:00 AM
Here's pinvoke over the underlying Windows API that dsregcmd calls: gist.github.com/awakecoding/...
Get Azure AD (Entra ID) Join Information without dsregcmd
Get Azure AD (Entra ID) Join Information without dsregcmd - Get-AadJoinInformation.ps1
gist.github.com
September 24, 2025 at 1:16 AM
It’d probably work if you implement pInvoke hopks for querying GCKeyboard from C# and register a custom input device.

developer.apple.com/documentatio...

docs.unity3d.com/Packages/com...
GCKeyboard | Apple Developer Documentation
An object that represents a physical keyboard connected to a device.
developer.apple.com
July 16, 2026 at 1:57 PM
I've spent most of my career insulated from having to know it by a JIT. I do believe there was once I had to debug some kind of PInvoke or COM Interop problem where I had to get down into the assembly, but otherwise...
December 10, 2025 at 4:59 PM
oh heck yeah, just learned about libobjc.A.dylib, that's *exactly* what I want! this blog post even goes into details about how to pinvoke it from C# jonathanpeppers.com/Blog/xamarin...
Xamarin.iOS Under the Hood: Calling Objective-C from C# | Jonathan Peppers' Blog | Xamarin MVP | C# .Net Developer | Bowling Green, KY | Jon Peppers
Xamarin MVP and lead developer on the game, Draw a Stickman: EPIC. Jonathan Peppers works at Hitcents, on cross platform C# development using Xamarin.iOS, Xamarin.Android, and plain ol' .Net on Window...
jonathanpeppers.com
December 12, 2024 at 2:02 PM
Subclassing in this context means “replacing a window function (WinProc) with your own”. It’s surprisingly simple to do and use, once you understand the general design. But that requires dealing with pointers, 32 and 64-bit adresses, via PInvoke and Marshal namespaces.
May 20, 2023 at 1:35 PM
I enjoy pinvoke marshalling debugging, ghidra and having to check the internals of way too many shit just to get every player logs :)

github.com/LavaGang/Mel...

This took forever like a week+ and I need a break, but that was the hardest part so I'm happy :)
Implement optional Unity player logs capture to our logs by aldelaro5 · Pull Request #885 · LavaGang/MelonLoader
This pr adds an opt in setting that allows the bootstrap to capture every single logs unity produces (player, stdout and stderr) to the console and almost all of them to our logs file (there's ...
github.com
March 6, 2025 at 10:39 PM
I'm not porting PowerShell to NativeAOT, as it is fundamentally incompatible. I'm building a facade of PowerShell SDK APIs that go through the Rust multi-pwsh FFI which loads the .NET runtime from PowerShell to call the managed APIs from unmanaged code... and wrap that again in managed pinvoke
July 29, 2026 at 10:39 AM
[crossgen2] Prevent inlining of PInvoke marshalling accross version bubbles (115277) https://github.com/dotnet/runtime/pull/115277
[crossgen2] Prevent inlining of PInvoke marshalling accross version bubbles by jkotas · Pull Request #115277 · dotnet/runtime
Contributes to #113742
github.com
May 4, 2025 at 3:22 AM
Test failure: Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutExp/MarshalStructAsLayoutExp.cmd (113050) https://github.com/dotnet/runtime/issues/113050
Test failure: Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutExp/MarshalStructAsLayoutExp.cmd · Issue #113050 · dotnet/runtime
Failed in: runtime-coreclr r2r-extra 20250301.1 Failed tests: R2R-CG2 osx arm64 Checked jitstress1_tiered @ osx.13.arm64.open - Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutExp/MarshalStr...
github.com
March 3, 2025 at 2:23 AM