CppSharp 0.11.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CppSharp --version 0.11.0                
NuGet\Install-Package CppSharp -Version 0.11.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CppSharp" Version="0.11.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CppSharp --version 0.11.0                
#r "nuget: CppSharp, 0.11.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CppSharp as a Cake Addin
#addin nuget:?package=CppSharp&version=0.11.0

// Install CppSharp as a Cake Tool
#tool nuget:?package=CppSharp&version=0.11.0                

CppSharp is a tool and set of libraries which allows programmers to use C/C++ libraries with high-level programming languages (such as C#).

It is a tool that takes C/C++ header and library files and generates the necessary glue to surface the native API as a managed API. Such an API can be used to consume an existing native library in your high-level code or add scripting support to a native codebase.

The supported target languages at present are C# and C++/CLI.

It can also be used as a library to parse native code into a syntax tree with a rich declaration and type information model.

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

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CppSharp:

Package Downloads
Spout.NET

Spout.NET is a C# .NET Implementation for Spout2, A video frame sharing system.

BindingGenerator

CppSharp based binding generator for dotnet

GitHub repositories (7)

Showing the top 5 popular GitHub repositories that depend on CppSharp:

Repository Stars
tooll3/t3
Tooll 3 is an open source software to create realtime motion graphics.
Ruslan-B/FFmpeg.AutoGen
FFmpeg auto generated unsafe bindings for C#/.NET and Core (Linux, MacOS and Mono).
ddobrev/QtSharp
Mono/.NET bindings for Qt
sdcb/OpenVINO.NET
High quality .NET wrapper for OpenVINO™ toolkit.
sdcb/Sdcb.FFmpeg
FFmpeg basic .NET API generated by CppSharp
Version Downloads Last updated
1.1.5.3168 38,162 10/18/2023
1.1.1.10805 7,599 10/18/2023 1.1.1.10805 is deprecated because it has critical bugs.
1.0.76.8341 8,545 10/18/2023 1.0.76.8341 is deprecated because it has critical bugs.
1.0.54.626 20,485 5/31/2023
1.0.45.22293 23,555 2/6/2023
1.0.1 55,746 12/30/2021
1.0.0 17,929 10/12/2021
0.11.2 20,578 2/4/2021
0.11.1 9,207 2/3/2021
0.11.0 9,399 1/29/2021
0.10.5 28,443 6/27/2020
0.10.4 2,348 5/23/2020
0.10.3 4,550 4/9/2020
0.10.2 5,897 3/28/2020
0.10.1 7,577 7/4/2019
0.10.0 2,892 6/25/2019
0.9.2 2,760 5/7/2019
0.9.1 2,376 4/13/2019
0.9.0 7,927 3/1/2019
0.8.23 2,662 1/31/2019
0.8.22 4,448 9/24/2018
0.8.21 3,199 8/1/2018
0.8.20 3,048 5/25/2018
0.8.19 3,494 2/4/2018
0.8.18 3,535 1/27/2018
0.8.17 2,950 12/25/2017
0.8.16 3,125 11/10/2017
0.8.15 2,540 11/7/2017
0.8.14 4,164 9/17/2017
0.8.13 2,941 7/18/2017
0.8.12 2,496 7/18/2017
0.8.11 3,257 6/4/2017
0.8.10 2,968 4/23/2017
0.8.9 2,550 4/16/2017
0.8.8 2,470 4/9/2017
0.8.7 2,684 3/27/2017
0.8.6 2,858 3/4/2017
0.8.5 2,531 3/4/2017
0.8.4 3,408 2/10/2017
0.8.3 2,621 2/5/2017
0.8.2 2,608 1/25/2017
0.8.1 2,566 1/22/2017
0.8.0 2,356 1/22/2017
0.7.13 2,547 1/16/2017
0.7.12 2,821 11/17/2016
0.7.11 2,468 11/13/2016
0.7.10 2,390 11/11/2016
0.7.9 2,561 11/2/2016
0.7.8 2,412 11/1/2016
0.7.7 2,645 11/1/2016
0.7.6 2,537 10/28/2016
0.7.5 2,431 10/27/2016
0.7.4 2,480 10/25/2016
0.7.3 2,475 10/1/2016
0.7.2 2,752 9/17/2016
0.7.1 2,436 9/13/2016
0.7.0 2,395 9/12/2016
0.6.0 2,376 6/24/2016
0.5.2 2,399 6/17/2016
0.5.1 2,321 6/17/2016
0.5.0 2,499 6/14/2016

- Upgrade to .NET Core 3.1 and improve build system

- Make auto-compiling of C# work with .NET Core

- Adding extract interface pass

- Add a log for changes per release

- Fixed alias of signed char cannot be marshaled

- Add missing quotes to support paths with spaces in build scripts

- Ignore the still unsupported dependent type names

- Rewrite GenerateEnumFromMacros helper to also look into enum items.

- Fix generation of overloads in NAPI by re-ordering final calculated states.

- Update expression evaluator code from latest upstream.

- Improve visiting options implementation in CodeGenerator.

- Clean multiline function signatures in the AST converter.

- Fix generation of text blocks using NewLineKind.IfNotEmpty.

- Git ignore IDEA project folders.

- Change XML comments to be tested at run-time

- Generate valid C++ for pointers in template args

- Better detect invalid specialized functions

- Simplify the marking of invalid functions

- Generate valid C++ for protected constructors

- Generate valid C++ for protected destructors

- Only implement abstract classes in C++ for ctors/dtors

- Fix test generation for QuickJS generator.

- Remove unused code in QuickJS module generator.

- Add enum support to QuickJS generator.

- Marshaling correctness fix for enum and primitive types in NAPI.

- Abstract marshaler into overridable method in NAPI sources.

- Extract NAPI VarPrefix and ArgumentPrefix to base class.

- Add missing clang headers

- Create a single nuget package that supports windows / linux / macos

- Refactor QuickJS generator structure to follow NAPI patterns.

- Add initial QuickJS primitive type support and test suite.

- Ensure a tested specialization is really generated

- Place all output of tests in their own directories

- Use C++17 in all native projects

- Disable getter/setter to property pass by default in non-managed backends.

- Fix forward include collector to consider value class semantics in function returns.

- Factor VarPrefix and ArgumentPrefix helpers into base marshaler.

- Implement basic visiting behavior in some CodeGenerator overloads.

- Normalize visiting overloads to be virtual.

- Flush `Module.ExternalClassTemplateSpecializations` to avoid emitting the same specialization in multiple files

- Add initial Node and N-API testing infrastructure and tests.

- Big update to NAPI generator with initial support for basic examples.

- Add DFA/NFA state machine utility code.

- Replace outdated Clang compiler flags such as `std=c++1z` and replace it with `std=c++17`

- Change `GenerateSequentialLayout` default value to `true`

- Simplify TU.FileRelativeDirectory by using Path.GetDirectoryName.

- Update driver to only generate system modules for C# generators.

- Add ILibrary.GenerateCode as a custom code generation callback.

- Upgrade .NET projects to C# 8.0.

- Improve generation of type printing declaration names for C language.

- Rework constructor generation in C++ code generator.

- Setup include dirs on the module instead of parser options in the CLI.

- Improve error handling in CLI and avoid defaulting to a generator on unknown option..

- Add N-API generator support to the CLI.

- Extract and re-use GetIncludePath across multiple generators.

- Fix TU.FileRelativeDirectory to be more robust against some paths.

- Fully resolve include dirs paths in driver option validation.

- Fix ShouldGenerateClassNativeField to use NeedsBase instead of HasBase.

- Update Class.HasNonIgnoredBase to use the actual base class.

- Fix rename pass not handling some declarations due to early return.

- Manage package versions centrally

- Add `LanguageVersion.CPP20` support

- Only upload artifacts from master branch

- Make unit tests independent of the generator

- Simplify code that regenerates test bindings

- Only use premake for native projects and improve c# projects.

- Move GeneratorTestFixture type to its own file.

- Fix typo and move alignment offsets to cpp file

- Export or implement accessible functions in tests

- Export symbols for indirectly accessible constructors

- Publish artifacts for CI builds (#1533)

- Fix importing/exporting redeclaration in symbols

- CI: Add `Restore` step to make it easier to analyze build times

- Don't warn repeatedly about an existing LLVM dir

- Don't download LLVM if its destination exists

- Fix the expression-generator after changed paths

- Fix a regressive crash when generating parser bindings

- Remove redundant overrides from the generated C++/CLI

- Disable the msvc warning about unexported template specializations

- Fix naive version comparison

- Fix GCC version detection

- Move all LLVM files to /build/llvm

- Ignore premake5 binaries

- Remove secondary Zstandard compression from LLVM packages

- Show a message explaining how to build LLVM when a pre-built package is unavailable.

- Fix wrong LLVM package name when GCC version is >= 10

- Add LLVM commands to build.sh

- Test using a specialization from a dependent module

- Add install_tools target to build.sh and fix LLVM CI.

- Deprecate GCC 7 and add GCC 10 build for LLVM CI.

- Move generated .vcxproj files back to their original place

- Add missing `-configuration` option to build.sh script

- Replace Generate*.bat files with a single generate.sh which uses VS2019 by default

- Remove DownloadDeps.bat file

- Add build.sh and test.sh with execute permissions

- Only search for MSVC toolchain in Windows

- Generate correct LLVM package name regardless of the current operating system

- Avoid using "action:vs* filter because there are better ones that are more specific (#1523)

- Convert the visiting options to an enum

- Update CanCheckCodeGenInfo to check function types as well.

- Check for a dependent expression before walking variable initializer.

- Some Premake robustness fixes for Clang toolchain.

- Use explicit native type printer kind in CLI headers code.

- Ignore testing the incorrect marshalling of parameters typed const& to primitives

- Don't check the unsupported operator= for symbols

- Add initial NAPI and JS generator.

- Add initial QuickJS generator.

- Add C++ generator support to the CLI.

- Remove artificial limitations for cross-generation in CLI.

- Simplify target-specific message output code in CLI.

- Add a new option to set a prefix for generated files in CLI.

- Improve module naming heuristics and add an option for setting it explicitly.

- Implement C support as generator kind in CLI.

- Refactor string.Format calls in CLI.

- Implement Method.HasSameSignature for signature comparison.

- Implement Method.ToString() to help with debugging.

- A temporary hack to deal with a bug in MSVC v142 - VS 2019 build tools

- Don't wrap trivial constructors and destructors

- Ensure bindings are regenerated as needed without using DisableFastUpToDateCheck (#1511)

- Continue implementation of C++ generator.

- Add pass to fix up pure C++ methods to C++ generator.

- More robust C++ type printing of incomplete class declarations.

- Save existing parameter when doing C++ parameter type printing.

- Add initial C base generator.

- Check if module exists before using it in C code generator.

- More robust enum generation for C family languages in C code generator.

- Fix C generator GenerateMethodSpecifier to support pure and const specifiers.

- Add set of generated declarations to CLITypeReferences.

- Add initial block visitor to GeneratorOutputPass.

- Only add files to module if module is not null.

- Add per-declaration support for decl maps.

- Add BlockGenerator.NeedsNewLine helper property.

- Fix class nested enums to be handled by the rename pass.

- Document recently added GenerationOutputMode option.

- Add TypeQualifiersMode to Type and implement in C++ type printer.

- Add new VisitQualifiedType overload to visitors.

- Set include path as weell as file path when creating a new TU.

- Fix IsGeneratedOverride to take virtual methods into account.

- Add some helper class hierarchy methods.

- Fix CppMarshal WriteClassInstance to deal with incomplete classes.

- Rework Generator interface and add GenerationOutputMode option.

- Improve IsTypeComplete to be more robust.

- Improve ignored check for decls with explicit generation kinds.

- Generate acessor methods for C targets in field to property pass..

- Set the correct enum integer type in GenerateEnumFromMacros.

- Fix ignored base checking in CheckIgnoredDecls.

- Be more strict when constructing a regex for parsing macros.

- Handle enum items in rename pass.

- Fix code to use BaseClass property instead of first base.

- Add initial implementation of declaration maps.

- Remove unsupported Visual Studio versions from generate options

- Rename GenerateProjects.bat to Generate.bat

- Add GenerateVS2019.bat shortcut similar to GenerateMake.bat

- Prevent projects from picking up obj files that are generated sometimes (#1508)

- Fix all of our warnings in the parser

- Fix error in Tests.lua by requiring gmake2 module.

- Add a GCC 9 build to the LLVM CI build matrix.

- Fix minor issue when invoking Premake without an action.

- Compress LLVM archives using zstd.

- Call MSBuild in x86 build with Win32 platform.

- Pass the target architecture when building LLVM.

- Publish artifacts after building LLVM.

- Fix VS environment paths by setting global env variables.

- Do not use LLD when building LLVM under macOS.

- Generate C++ for constructors of abstract types

- Use NUnit3TestAdapter package (#1504)

- Add a build for LLVM to the CI

- Use correct C# parser bindings for windows x64 (#1501)

- Avoid installing NUnit if its already installed. (#1500)

- Generate code from tests where libraries appear

- Fix generation of SequentialLayout structures (#1499)

- Update parser bindings. (#1497)

- Fix CS0162 warning about unreachable code (#1492)

- Fix CS0109 warnings about new keyword not being required. (#1493)

- Enable Multi-processor Compilation (MSVC)

- Fix C4273 warnings about inconsistent dll linkage (#1491)

- Fix warnings about unnecessary using directives. (#1489)

- Fix C4251 warnings (#1487)

- Avoid generating an interface with a Dispose method if we already inherit from IDisposable. (#1486)

- Fix finding of symbols for members of templates

- Always ignore warnings about missing PDB files

- Reduce number of "download progress" messages. (#1482)

- Mark variables with constant expressions as found

- Make the CPP ABI visible only to the STD symbols

- Generate valid C++ for destructors of nested types

- Always use the mangled names as reported by Clang

- Switch CI to GitHub Actions

- Call the destructor instead of deleting the object in the generated symbols

- Regenerate the parser bindings with sequential layouts (#1479)

- Remove dummy variable and use discards instead available since C# 7.0 (#1478)

- Fallback to LayoutKind.Explicit when a custom alignment is specified. (#1476)

- Remove `Layout.GetSize()` method as it's no longer relevant (#1474)

- Fix `String.CSharpSignatureType` returning incorrect type when the given type is a pointer or a reference. (#1473)

- Expose if a variable is a constant expression

- Fix the generation of sequential layouts

- Create projects which always build generated code

- Simplify the marshalling of returned pointers (#1470)

- VTable: improve codegen & make it thread safe (#1469)

- Create VTables class to cache delegates pointing to native virtual methods (#1468)

- Improve UTF32Marshaller performance (#1467)

- Improve generation of C# (#1466)

- Reduce calls to ConcurrentDictionary to improve performance (#1464)

- Ensure expression is a valid float constant before trying to append `f` suffix (#1465)

- Fix passing of CMake options to LLVM on Windows

- Update the kind of completed specializations (#1460)

- Fix ambiguous conversion functions (#1458)

- Prevent string destructor from being called twice when its passed by value (#1455)

- Remove unsupported calling convention usage (#1454)

- Fix PInvokeStackImbalance when calling C++ methods (#1453)

- Load symbols at startup to avoid very expensive ResolveSymbol calls everywhere (#1447)

- Fix IntPtr array marshalling bug and move hard to read code to CppSharp.Runtime (#1446)

- Fix string marshalling bug and move hard to read code to CppSharp.Runtime (#1445)

- Add support for const char32_t* and fix const wchar_t* in linux / osx (#1444)

- Copy arrays of primitive values using System.Buffers.MemoryCopy (#1440)

- Fix marshalling for bool arrays (#1439)

- Fix wrong [MarshalAs(UnmanagedType)] for strings (#1438)

- Remove call argument to fix broken build (#1436)

- Basic support for static constexpr variables (#1435)

- Add support for C++ character literals (u, U, L) (#1434)

- Upgrade premake in preparation for .NET Core (#1298)

- Use C# 'default literal' to avoid using a type's name that may be renamed (#1432)

- Add missing `Variable.Type` null check. (#1430)

- Fix generated constructor cant use `placement new` when class overloads `operator new` (#1431)

- Fix generation of VS projects under non-Windows platforms.

- Fix wrong marshalling for static member arrays (#1428)

- Fix wrong generated destructor

- Ignore non-const data() method for std types like basic_string [c++17] (#1427)

- Fix crash when trying to read a CXXRecordDecl that doesn't have a definition (#1426)

- RemovePass is now generic.

- Added the ability to remove a built-in pass.

- Fix anonymous member name colliding with enclosing type name (#1425)

- Allow the users to overwrite CppSharp type maps.

- Find libraries even when given with no extensions

- Add an option for building with Visual Studio 2019

- Fix GCC path detection for Ubuntu 20.

- Move libraries to a new class for linking options

- Fix memory leaks when using the driver

- Simplify ClangParser by making it static

- Pack the lld headers as well

- Import native DLL-s (tests and parser) with MSVC

- Implement and export all methods in tests