Open
Description
Brief Description
I'm trying to generate simple bindings as documented here: https://github.com/mono/CppSharp/blob/master/docs/GeneratingBindings.md
The weird thing is that I was able to generate the biding successfully on this machine and now it's throwing this error:
Assertion: should not be reached at ..\mono\metadata\metadata.c:3035
OS: Windows 10
The code:
using System;
using CppSharp;
using CppSharp.AST;
using CppSharp.Generators;
namespace CppSharpGenerator
{
class Program
{
static void Main(string[] args)
{
ConsoleDriver.Run(new SampleLibrary());
}
}
public interface ILibrary
{
/// Setup the driver options here.
void Setup(Driver driver);
/// Setup your passes here.
void SetupPasses(Driver driver);
/// Do transformations that should happen before passes are processed.
void Preprocess(Driver driver, ASTContext ctx);
/// Do transformations that should happen after passes are processed.
void Postprocess(Driver driver, ASTContext ctx);
}
}
public class SampleLibrary : ILibrary
{
public void Postprocess(Driver driver, ASTContext ctx)
{
//throw new NotImplementedException();
}
public void Preprocess(Driver driver, ASTContext ctx)
{
//throw new NotImplementedException();
}
public void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = GeneratorKind.CSharp;
var module = options.AddModule("Sample");
module.IncludeDirs.Add(@"C:\Sample\include");
module.Headers.Add("Sample.h");
}
public void SetupPasses(Driver driver)
{
//throw new NotImplementedException();
}
}
Used headers
Sample.h
#pragma once
class Foo
{
public:
int a;
float b;
};
Used settings
Mono JIT compiler version 6.8.0 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notification: Thread + polling
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
Suspend: preemptive
GC: sgen (concurrent by default)
I'm running this on the command line:
mcs -r:CppSharp.dll -r:CppSharp.AST.dll -r:CppSharp.Generator.dll Program.cs
mono -v Program.exe
Stack trace or incompilable generated code
Last lines of the output:
...
converting method void CppSharp.Driver:.cctor ()
Method void CppSharp.Driver:.cctor () emitted at 000001AA3DC391E0 to 000001AA3DC3923A (code length 90) [Program.exe]
converting method (wrapper runtime-invoke) object object:runtime_invoke_void (object,intptr,intptr,intptr)
Method (wrapper runtime-invoke) object object:runtime_invoke_void (object,intptr,intptr,intptr) emitted at 000001AA3DC39260 to 000001AA3DC39390 (code length 304) [Program.exe]
converting gshared method void System.Collections.Generic.Dictionary`2<CppSharp.AST.Module, string>:.ctor ()
Method void System.Collections.Generic.Dictionary`2<TKey_REF, TValue_REF>:.ctor () emitted at 000001AA3DC393A0 to 000001AA3DC393C9 (code length 41) [Program.exe]
converting gshared method void System.Collections.Generic.Dictionary`2<CppSharp.AST.Module, string>:.ctor (int,System.Collections.Generic.IEqualityComparer`1<CppSharp.AST.Module>)
Method void System.Collections.Generic.Dictionary`2<TKey_REF, TValue_REF>:.ctor (int,System.Collections.Generic.IEqualityComparer`1<TKey_REF>) emitted at 000001AA3DC393F0 to 000001AA3DC39520 (code length 304) [Program.exe]
converting method void CppSharp.Driver:set_Options (CppSharp.DriverOptions)
Method void CppSharp.Driver:set_Options (CppSharp.DriverOptions) emitted at 000001AA3DC39560 to 000001AA3DC395A8 (code length 72) [Program.exe]
converting method void CppSharp.Parser.ParserOptions:.ctor ()
Method void CppSharp.Parser.ParserOptions:.ctor () emitted at 000001AA3DC395C0 to 000001AA3DC39645 (code length 133) [Program.exe]
converting method void CppSharp.Parser.CppParserOptions:.ctor ()
Method void CppSharp.Parser.CppParserOptions:.ctor () emitted at 000001AA3DC39690 to 000001AA3DC39722 (code length 146) [Program.exe]
* Assertion: should not be reached at ..\mono\metadata\metadata.c:3035