© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
84 replies
voltagex

LibraryImport examples, especially on Linux

Has anyone got examples of usage of the newer LibraryImport infrastructure (?) as opposed to DllImport?

I have seen https://stackoverflow.com/questions/75304403/marshalling-function-pointers-with-net-7-libraryimport which just about melted my face off

and https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke-source-generation isn't bad but no one seems to be using this in open source code.
Stack Overflow
Marshalling Function Pointers with .NET 7 LibraryImport
I'm trying to implement some P/Invoke code using the new LibraryImport attribute, as opposed to the old DllImport. Specifically, I am trying to marshal a WNDCLASSEXW struct for use in RegisterClass...
Marshalling Function Pointers with .NET 7 LibraryImport
P/Invoke source generation - .NET
Learn about compile-time source generation for platform invokes in .NET.
P/Invoke source generation - .NET
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

SourceGenerator and LibraryImport
C#CC# / help
2y ago
Help with LibraryImport and custom marshalling
C#CC# / help
2y ago
❔ C# on Linux
C#CC# / help
3y ago
❔ Developing on linux?
C#CC# / help
3y ago