gir.core icon indicating copy to clipboard operation
gir.core copied to clipboard

Consider LibraryImport over DllImport?

Open badcel opened this issue 2 years ago • 0 comments

https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke-source-generation

LibraryImport could perhaps improve string marshaling and is source generated. Available with dotnet 7.

This allows to use pretty flexible custom marshallers:

  • https://learn.microsoft.com/en-us/dotnet/standard/native-interop/tutorial-custom-marshaller
  • https://learn.microsoft.com/en-us/dotnet/standard/native-interop/custom-marshalling-source-generation?source=recommendations

This could be handy to implement aliases which is needed for #757.

Requires .NET7

badcel avatar Nov 20 '22 16:11 badcel