Skip to content

Use LibraryImportAttribute instead of DllImportAttribute #1687

Open
@jasoncouture

Description

@jasoncouture
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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions