Bindgen.NET
1.0.0
進行中の作業
Nugetパッケージをダウンロードします。
dotnet add package Bindgen.NET --version *-*ClangSharpネイティブの依存関係を解決するには、ランタイムIDが必要です。プロジェクトファイルは次のようになります。
< Project Sdk = " Microsoft.NET.Sdk " >
< PropertyGroup >
< OutputType >Exe</ OutputType >
< TargetFramework >net7.0</ TargetFramework >
<!-- This line is required -->
< RuntimeIdentifier Condition = " '$(RuntimeIdentifier)' == '' " >$(NETCoreSdkRuntimeIdentifier)</ RuntimeIdentifier >
</ PropertyGroup >
< ItemGroup >
< PackageReference Include = " Bindgen.NET " Version = " *-* " />
</ ItemGroup >
</ Project >バインディングオプションを構成して生成します!
例:
using Bindgen . NET ;
BindingOptions exampleConfig = new ( )
{
Namespace = "ExampleNamespace" ,
Class = "ExampleClass" ,
DllImportPath = "libexample" ,
// Pass raw source code instead
// TreatInputFileAsRawSourceCode = true,
InputFile = "path/header.h" ,
OutputFile = "path/Header.cs" ,
IncludeDirectories = { "path/include" } ,
SystemIncludeDirectories = { "path/include" } ,
GenerateFunctionPointers = true ,
GenerateMacros = true ,
GenerateStructEqualityFunctions = true
} ;
string output = BindingGenerator . Generate ( exampleConfig ) ;実行可能な例はここにあります。
生成されたバインディングの基本的な例は、こちらにあります。
生成されたバインディングの現実世界の例は、FLECS.NETリポジトリで見ることができます。