ClangSharpPInvokeGenerator 21.1.8.4

Requires NuGet 4.3 or higher.

dotnet tool install --global ClangSharpPInvokeGenerator --version 21.1.8.4
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local ClangSharpPInvokeGenerator --version 21.1.8.4
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ClangSharpPInvokeGenerator&version=21.1.8.4
                    
nuke :add-package ClangSharpPInvokeGenerator --version 21.1.8.4
                    

ClangSharpPInvokeGenerator

ClangSharpPInvokeGenerator is a .NET tool that generates strongly-typed C#/.NET P/Invoke bindings from C and C++ header files by parsing them with libclang. It is part of the ClangSharp project, which is self-hosted and uses this tool to auto-generate its own bindings.

Installing

Install the generator as a global .NET tool:

dotnet tool install --global ClangSharpPInvokeGenerator

NOTE: The generator depends on the native libClang and libClangSharp libraries. When running as a .NET tool, you may need to manually copy the appropriate native DLLs from the libClang and libClangSharp packages due to limitations in the .NET tool support. See #46 and #118 for details.

Usage

At a minimum, the tool expects one or more input files (-f), an output namespace (-n), and an output location (-o):

ClangSharpPInvokeGenerator -f example.h -n Example.Namespace -o Example.cs

The simplest and recommended setup is to use a response file, which lets you specify and check in the command line arguments in a text file with one argument per line:

ClangSharpPInvokeGenerator @generate.rsp

See GenerateClang.rsp for a real-world example. A typical response file also specifies explicit files to traverse, configuration options, name remappings, and other fixups.

You can see the full set of available switches by passing --help, and the available configuration options by passing -c help.

More information

License

Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See LICENSE.md in the repository root for more information.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
21.1.8.4 0 7/15/2026
21.1.8.3 10,903 3/23/2026
21.1.8.2 1,299 1/16/2026
21.1.8 535 1/5/2026
20.1.2.4 4,896 10/15/2025
20.1.2.3 1,222 9/1/2025
20.1.2.2 814 8/19/2025
20.1.2.1 12,964 5/24/2025
20.1.2 1,033 5/11/2025
18.1.0.4 1,539 4/8/2025
18.1.0.3 18,040 1/15/2025
18.1.0.2 2,295 9/26/2024
18.1.0.1 1,107 7/21/2024
18.1.0 11,705 5/15/2024
17.0.1 6,281 12/15/2023
17.0.0 1,363 11/24/2023
16.0.0 16,508 6/21/2023
15.0.2 32,325 11/7/2022
15.0.1 1,035 9/29/2022
15.0.0 1,429 9/18/2022
Loading failed