CppSharp
CppSharp copied to clipboard
Use LibraryImportAttribute instead of DllImportAttribute
Brief Description
When code generation is targeting .NET 7, LibraryImport
should be used in place of DllImport
as this will pre-generate marshalling operations normally performed at runtime.
When framework target is lower than .NET 7, DllImport
should continue to be used.
More information about LibraryImportAttribute
can be found here: https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-preview-7/#libraryimport-p-invoke-source-generator
(Non os specific, code generation)
OS: N/A
Thanks for the heads up.
+1. Having the option to generate LibraryImport would be really useful!