Skip to content

LibraryImportAttribute emits DllImport in generated code #77086

Answered by alexrp
PhilPJL asked this question in Q&A
Discussion options

You must be logged in to vote

Yes. The goal isn't to avoid DllImport, it's to avoid runtime marshaling of parameters and return values. The generated DllImport-decorated method will only use blittable types, while the wrapper does marshaling through source generation before/after calling it.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PhilPJL
Comment options

Answer selected by danmoseley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants