Bindgen.NET
1.0.0
Bekerja dalam proses
Unduh paket Nuget.
dotnet add package Bindgen.NET --version *-*ID runtime diperlukan untuk menyelesaikan dependensi asli Clangsharp. File proyek Anda akan terlihat seperti ini.
< 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 >Konfigurasikan opsi mengikat Anda dan buat!
Contoh:
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 ) ;Contoh runnable dapat ditemukan di sini.
Contoh dasar binding yang dihasilkan dapat ditemukan di sini.
Contoh dunia nyata dari binding yang dihasilkan dapat dilihat dalam repo FLECS.NET di sini.