https://github.com/mono/cppsharp/blob/m ... Started.md
i. In dem Eindruck, dass die Verwendung von CPPSharp eine C# -Anwendung (für die Einfachheit einer Konsolenanwendung) erstellen muss, implementieren Sie eine abstrakte Klasse aus CPPSharp und führen Sie einige Befehle von CPPSharp aus. Von
https://github.com/mono/cppsharp/issues/82
Bearbeiten: Jetzt verwende ich den folgenden Code
Code: Select all
using CppSharp;
using CppSharp.AST;
using CppSharp.Generators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CppSharpTransformer
{
class DllDemoGenerator : ILibrary
{
public static void Main(string[] args)
{
ConsoleDriver.Run(new DllDemoGenerator());
}
void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = GeneratorKind.CSharp;
var module = options.AddModule("Sample");
module.IncludeDirs.Add(@"C:\Users\Boehm.J\Documents\CppSharpSamples\Sample\include");
module.Headers.Add("Sample.h");
module.LibraryDirs.Add(@"C:\Users\Boehm.J\Documents\CppSharpSamples\Sample\lib");
module.Libraries.Add("Sample.lib");
}
public void SetupPasses(Driver driver) { }
public void Preprocess(Driver driver, ASTContext ctx)
{
}
public void Postprocess(Driver driver, ASTContext ctx)
{
}
void ILibrary.Setup(Driver driver)
{
}
}
}
cppsharp.cli.dll
cppsharp.cppparser.dll
cppsharp.dll
cppsharp.generator. />cppsharp.parser.cli.dll
cppsharp.parser.csharp.dll
cppsharp.parser.dll End />cppsharp.runtime.dll
Ich habe sie unter "Abhängigkeiten (AbhänGigKeiten) hinzugefügt und auch als Dateien als Mitglieder meines Projekts. 'Cppsharp.parser.cli, Version = 0,0.0.0,
Culture = neutral, PublicKeyToken = NULL'. Das System kann Die Angegebe
Datei Nick Funde. It occurs in
C:\Users\Boehm.J\Documents\work\CppSharpTransformer\CppSharpTransformer
and in
c:\users\boehm.j\Documents\Work\cppsharPtransformer\cppsharPtransformer\Bin\x64\release\Net6.0 < /blockquote>