Bindgen.NET
1.0.0
العمل قيد التقدم
قم بتنزيل حزمة Nuget.
dotnet add package Bindgen.NET --version *-*هناك حاجة إلى معرف وقت التشغيل لحل التبعيات الأصلية Clangsharp. يجب أن يبدو ملف مشروعك هكذا.
< 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 repo هنا.