Skill / SKILL.md

Dotnet Pinvoke

dotnet/skills

Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P/Invoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed/native boundary. DO NOT USE FOR: COM interop, C++/CLI mixed-mode assemblies, or pure managed code with no native dependencies.
2 views 6,410 repository stars 0 commentsUpdated Nov 27, 2026
Overview

Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P/Invoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed/native boundary. DO NOT USE FOR: COM interop, C++/CLI mixed-mode assemblies, or pure managed code with no native dependencies.

Installation & variants

Download the repository, including the skill’s supporting files.

git clone -- 'https://github.com/dotnet/skills' skill-source

Use the complete skill-source/plugins/dotnet-advanced/skills/dotnet-pinvoke directory with your client’s skill installer.

  • plugins/dotnet-advanced/skills/dotnet-pinvoke

    main · SKILL.md

    Open installation source

    Source directory recorded from the imported repository path

Source directory plugins/dotnet-advanced/skills/dotnet-pinvoke

Source instructions
Read source instructions

Open to load source instructions

Original SKILL.md

Open to load the original file

Source & validation
Source status
Awaiting source check
Format validation
Format valid
Checked at
Pending source check
Content SHA-256
8ca2f31a866979a9ad01f9b12682480e2097e69da21f1c33f8d185faaf21157d
Discussion
Comments Be the First to Comment

Please log in to comment

    No comments yet

Related skills