dotnet-native-interop

Community

Call native code from .NET safely.

AuthorAGIBuild
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides comprehensive guidance on how to safely and efficiently call native libraries (like C/C++ DLLs or SOs) from your .NET applications using Platform Invoke (P/Invoke).

Core Features & Use Cases

  • Modern P/Invoke: Demonstrates the use of [LibraryImport] (.NET 7+) for AOT-compatible, source-generated marshalling.
  • Legacy P/Invoke: Covers [DllImport] for older .NET versions and specific scenarios.
  • Cross-Platform Resolution: Explains how to handle different library names and loading mechanisms across Windows, macOS, Linux, iOS, and Android.
  • Marshalling: Details how to correctly marshal various data types, including structs, strings, and function pointers.
  • Resource Management: Emphasizes using SafeHandle for robust native resource lifetime management.
  • Use Case: Integrate a high-performance native image processing library into your .NET desktop application, ensuring correct data transfer and resource cleanup across different operating systems.

Quick Start

Use the dotnet-native-interop skill to learn how to call a C function named 'process_data' from a native library 'mylib.dll' on Windows.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: dotnet-native-interop
Download link: https://github.com/AGIBuild/Agibuild.Fulora/archive/main.zip#dotnet-native-interop

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.