Summary
Adopt source-generated interop (LibraryImport) for libsodium bindings targeting current runtime support.
Why
LibraryImport can reduce runtime marshalling overhead versus reflection-based DllImport, improving hot-path crypto command performance.
Proposed change
- Replace
[DllImport] declarations with [LibraryImport] for supported target frameworks.
- Add explicit marshalling annotations where needed (
In/Out semantics).
- Validate function signatures and calling convention parity.
- Preserve current API surface exposed to PowerShell.
Acceptance criteria
- Native calls remain functionally equivalent across supported platforms.
- All existing tests pass on Windows/Linux/macOS CI matrices.
- Benchmarks show measurable improvement or no regression.
- No breaking change in public PowerShell cmdlet behavior.
Summary
Adopt source-generated interop (
LibraryImport) for libsodium bindings targeting current runtime support.Why
LibraryImportcan reduce runtime marshalling overhead versus reflection-basedDllImport, improving hot-path crypto command performance.Proposed change
[DllImport]declarations with[LibraryImport]for supported target frameworks.In/Outsemantics).Acceptance criteria