Skip to content

Perf: Migrate P/Invoke signatures from DllImport to LibraryImport #48

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions