© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
2 replies
Fredrik Høisæther Rasch

SourceGenerator and LibraryImport

I am considering writing my own source generator. Among other things it will also generate some PInvoke bindings. Ideally, I'd like to use LibraryImport instead of DllImport in the generated source.
But since LibraryImport in itself is a generator, can I do this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Help with LibraryImport and custom marshalling
C#CC# / help
2y ago
LibraryImport examples, especially on Linux
C#CC# / help
2y ago
SourceGenerator multiple steps (passing data from one to another)
C#CC# / help
2y ago
SourceGenerator is not working with .net48 as nuget package reference
C#CC# / help
4y ago