Browse Source

Check symbols in tests

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1398/head
Dimitar Dobrev 5 years ago
parent
commit
b5ca0635be
  1. 12
      src/AST/SymbolContext.cs
  2. 6
      src/AST/TargetTriple.cs
  3. 12
      src/AST/VariableExtensions.cs
  4. 33
      src/CppParser/Parser.cpp
  5. 4
      src/CppParser/Parser.h
  6. 93
      src/Generator/Generators/CSharp/CSharpSources.cs
  7. 2
      tests/CSharp/CSharp.Tests.cs
  8. 16
      tests/CSharp/CSharp.cpp
  9. 8
      tests/CSharp/CSharp.h
  10. 8
      tests/CSharp/CSharpTemplates.cpp
  11. 3
      tests/CSharp/CSharpTemplates.h
  12. 8
      tests/Common/Common.Tests.cs
  13. 46
      tests/Common/Common.cpp
  14. 20
      tests/Common/Common.h
  15. 4
      tests/NamespacesDerived/NamespacesDerived.cs

12
src/AST/SymbolContext.cs

@ -94,37 +94,35 @@ namespace CppSharp.AST @@ -94,37 +94,35 @@ namespace CppSharp.AST
public bool FindSymbol(ref string symbol)
{
NativeLibrary lib;
if (FindLibraryBySymbol(symbol, out lib))
if (FindLibraryBySymbol(symbol, out _))
return true;
string alternativeSymbol;
// Check for C symbols with a leading underscore.
alternativeSymbol = "_" + symbol;
if (FindLibraryBySymbol(alternativeSymbol, out lib))
if (FindLibraryBySymbol(alternativeSymbol, out _))
{
symbol = alternativeSymbol;
return true;
}
alternativeSymbol = symbol.TrimStart('_');
if (FindLibraryBySymbol(alternativeSymbol, out lib))
if (FindLibraryBySymbol(alternativeSymbol, out _))
{
symbol = alternativeSymbol;
return true;
}
alternativeSymbol = "_imp_" + symbol;
if (FindLibraryBySymbol(alternativeSymbol, out lib))
if (FindLibraryBySymbol(alternativeSymbol, out _))
{
symbol = alternativeSymbol;
return true;
}
alternativeSymbol = "__imp_" + symbol;
if (FindLibraryBySymbol("__imp_" + symbol, out lib))
if (FindLibraryBySymbol("__imp_" + symbol, out _))
{
symbol = alternativeSymbol;
return true;

6
src/Parser/TargetTriple.cs → src/AST/TargetTriple.cs

@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
using System.Linq;
namespace CppSharp.Parser
namespace CppSharp.AST
{
// over time we should turn this into a real class
// like http://llvm.org/docs/doxygen/html/classllvm_1_1Triple.html
public static class TargetTriple
{
public static bool IsWindows(string targetTriple)
public static bool IsWindows(this string targetTriple)
{
var parts = targetTriple.Split('-');
return parts.Contains("windows") ||
parts.Contains("win32") || parts.Contains("win64");
}
public static bool IsMacOS(string targetTriple)
public static bool IsMacOS(this string targetTriple)
{
var parts = targetTriple.Split('-');
return parts.Contains("apple") ||

12
src/AST/VariableExtensions.cs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
namespace CppSharp.AST
{
public static class VariableExtensions
{
public static string GetMangled(this Variable variable, string targetTriple) =>
variable.Mangled[0] == '_' && variable.Namespace is TranslationUnit &&
targetTriple.IsMacOS() ?
// the symbol name passed to dlsym() must NOT be prepended with an underscore
// https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlsym.3.html
variable.Mangled.TrimStart('_') : variable.Mangled;
}
}

33
src/CppParser/Parser.cpp

@ -4286,13 +4286,12 @@ ParserResult* Parser::Parse(const std::vector<std::string>& SourceFiles) @@ -4286,13 +4286,12 @@ ParserResult* Parser::Parse(const std::vector<std::string>& SourceFiles)
return res;
}
ParserResultKind Parser::ParseArchive(llvm::StringRef File,
ParserResultKind Parser::ParseArchive(const std::string& File,
llvm::object::Archive* Archive,
std::vector<CppSharp::CppParser::NativeLibrary*>& NativeLibs)
{
auto LibName = File;
auto NativeLib = new NativeLibrary();
NativeLib->fileName = LibName.str();
NativeLib->fileName = File;
for (const auto& Symbol : Archive->symbols())
{
@ -4324,13 +4323,12 @@ static void ReadELFDependencies(const llvm::object::ELFFile<ELFT>* ELFFile, CppS @@ -4324,13 +4323,12 @@ static void ReadELFDependencies(const llvm::object::ELFFile<ELFT>* ELFFile, CppS
NativeLib->Dependencies.push_back(Dependency.str());
}
ParserResultKind Parser::ParseSharedLib(llvm::StringRef File,
ParserResultKind Parser::ParseSharedLib(const std::string& File,
llvm::object::ObjectFile* ObjectFile,
std::vector<CppSharp::CppParser::NativeLibrary*>& NativeLibs)
{
auto LibName = File;
auto NativeLib = new NativeLibrary();
NativeLib->fileName = LibName.str();
NativeLib->fileName = File;
NativeLib->archType = ConvertArchType(ObjectFile->getArch());
NativeLibs.push_back(NativeLib);
@ -4450,29 +4448,34 @@ ParserResult* Parser::ParseLibrary(const LinkerOptions* Opts) @@ -4450,29 +4448,34 @@ ParserResult* Parser::ParseLibrary(const LinkerOptions* Opts)
{
auto res = new ParserResult();
for (const auto& Library : Opts->Libraries)
for (const auto& Lib : Opts->Libraries)
{
if (Library.empty())
if (Lib.empty())
{
res->kind = ParserResultKind::FileNotFound;
return res;
}
std::string PrefixedLib = "lib" + Lib;
std::string FileName;
std::string FileEntry;
using namespace llvm::sys;
for (const auto& LibDir : Opts->LibraryDirs)
{
using namespace llvm::sys;
std::error_code ErrorCode;
fs::directory_iterator Dir(LibDir, ErrorCode);
for (const auto& File = Dir;
Dir != fs::directory_iterator() && !ErrorCode;
Dir = Dir.increment(ErrorCode))
{
if (path::filename(File->path()) == Library ||
path::stem(File->path()) == Library ||
path::stem(path::stem(File->path())) == Library)
FileName = path::filename(File->path()).str();
if (FileName == Lib ||
FileName == PrefixedLib ||
path::stem(FileName) == Lib ||
path::stem(FileName) == PrefixedLib ||
path::stem(path::stem(FileName)) == Lib ||
path::stem(path::stem(FileName)) == PrefixedLib)
{
FileEntry = File->path();
goto found;
@ -4498,14 +4501,14 @@ ParserResult* Parser::ParseLibrary(const LinkerOptions* Opts) @@ -4498,14 +4501,14 @@ ParserResult* Parser::ParseLibrary(const LinkerOptions* Opts)
auto OwningBinary = std::move(BinaryOrErr.get());
auto Bin = OwningBinary.getBinary();
if (auto Archive = llvm::dyn_cast<llvm::object::Archive>(Bin)) {
res->kind = ParseArchive(Library, Archive, res->Libraries);
res->kind = ParseArchive(FileName, Archive, res->Libraries);
if (res->kind == ParserResultKind::Error)
return res;
}
if (auto ObjectFile = llvm::dyn_cast<llvm::object::ObjectFile>(Bin))
{
res->kind = ParseSharedLib(Library, ObjectFile, res->Libraries);
res->kind = ParseSharedLib(FileName, ObjectFile, res->Libraries);
if (res->kind == ParserResultKind::Error)
return res;
}

4
src/CppParser/Parser.h

@ -159,9 +159,9 @@ private: @@ -159,9 +159,9 @@ private:
llvm::object::basic_symbol_iterator End,
CppSharp::CppParser::NativeLibrary*& NativeLib);
Declaration* GetDeclarationFromFriend(clang::NamedDecl* FriendDecl);
static ParserResultKind ParseArchive(llvm::StringRef File,
static ParserResultKind ParseArchive(const std::string& File,
llvm::object::Archive* Archive, std::vector<CppSharp::CppParser::NativeLibrary*>& NativeLibs);
static ParserResultKind ParseSharedLib(llvm::StringRef File,
static ParserResultKind ParseSharedLib(const std::string& File,
llvm::object::ObjectFile* ObjectFile, std::vector<CppSharp::CppParser::NativeLibrary*>& NativeLibs);
ParserTargetInfo* GetTargetInfo();

93
src/Generator/Generators/CSharp/CSharpSources.cs

@ -837,25 +837,7 @@ namespace CppSharp.Generators.CSharp @@ -837,25 +837,7 @@ namespace CppSharp.Generators.CSharp
private void GenerateVariableSetter(Variable var)
{
TypePrinter.PushContext(TypePrinterContextKind.Native);
var location = $@"CppSharp.SymbolResolver.ResolveSymbol(""{
GetLibraryOf(var)}"", ""{var.Mangled}"")";
string ptr = Generator.GeneratedIdentifier("ptr");
Type varType = var.Type.Desugar();
var arrayType = varType as ArrayType;
var @class = var.Namespace as Class;
var isRefTypeArray = arrayType != null && @class != null && @class.IsRefType;
if (isRefTypeArray)
WriteLine($@"var {ptr} = {
(arrayType.Type.IsPrimitiveType(PrimitiveType.Char) &&
arrayType.QualifiedType.Qualifiers.IsConst ?
string.Empty : "(byte*)")}{location};");
else
WriteLine($"var {ptr} = ({varType}*){location};");
TypePrinter.PopContext();
string ptr = GetPointerTo(var);
var param = new Parameter
{
@ -867,7 +849,7 @@ namespace CppSharp.Generators.CSharp @@ -867,7 +849,7 @@ namespace CppSharp.Generators.CSharp
{
Parameter = param,
ArgName = param.Name,
ReturnType = new QualifiedType(varType)
ReturnType = var.QualifiedType
};
ctx.PushMarshalKind(MarshalKind.Variable);
@ -887,6 +869,36 @@ namespace CppSharp.Generators.CSharp @@ -887,6 +869,36 @@ namespace CppSharp.Generators.CSharp
UnindentAndWriteCloseBrace();
}
private string GetPointerTo(Variable var)
{
TypePrinter.PushContext(TypePrinterContextKind.Native);
string mangled = var.GetMangled(Context.ParserOptions.TargetTriple);
var location = $@"CppSharp.SymbolResolver.ResolveSymbol(""{
GetLibraryOf(var)}"", ""{mangled}"")";
var arrayType = var.Type as ArrayType;
string ptr = Generator.GeneratedIdentifier("ptr");
if (arrayType != null && var.Namespace is Class @class && @class.IsRefType)
{
WriteLine($@"var {ptr} = {
(arrayType.Type.IsPrimitiveType(PrimitiveType.Char) &&
arrayType.QualifiedType.Qualifiers.IsConst ?
string.Empty : "(byte*)")}{location};");
}
else
{
TypePrinter.PushMarshalKind(MarshalKind.ReturnVariableArray);
var varReturnType = var.Type.Visit(TypePrinter);
TypePrinter.PopMarshalKind();
WriteLine($"var {ptr} = ({varReturnType}*){location};");
}
TypePrinter.PopContext();
return ptr;
}
private void GenerateFunctionSetter(Class @class, Property property)
{
var actualProperty = GetActualProperty(property, @class);
@ -1125,42 +1137,18 @@ namespace CppSharp.Generators.CSharp @@ -1125,42 +1137,18 @@ namespace CppSharp.Generators.CSharp
private void GenerateVariableGetter(Variable var)
{
TypePrinter.PushContext(TypePrinterContextKind.Native);
string library = GetLibraryOf(var);
var location = $"CppSharp.SymbolResolver.ResolveSymbol(\"{library}\", \"{var.Mangled}\")";
var ptr = Generator.GeneratedIdentifier("ptr");
Type varType = var.Type.Desugar();
var arrayType = varType as ArrayType;
var elementType = arrayType?.Type.Desugar();
var @class = var.Namespace as Class;
var isRefTypeArray = arrayType != null && @class != null && @class.IsRefType;
if (isRefTypeArray)
{
string cast = elementType.IsPrimitiveType(PrimitiveType.Char) &&
arrayType.QualifiedType.Qualifiers.IsConst
? string.Empty : "(byte*)";
WriteLine($"var {ptr} = {cast}{location};");
}
else
{
TypePrinter.PushMarshalKind(MarshalKind.ReturnVariableArray);
var varReturnType = varType.Visit(TypePrinter);
TypePrinter.PopMarshalKind();
WriteLine($"var {ptr} = ({varReturnType}*){location};");
}
TypePrinter.PopContext();
string ptr = GetPointerTo(var);
var ctx = new CSharpMarshalContext(Context, CurrentIndentation)
{
ArgName = var.Name,
ReturnType = new QualifiedType(var.Type)
ReturnType = var.QualifiedType
};
ctx.PushMarshalKind(MarshalKind.ReturnVariableArray);
var arrayType = var.Type.Desugar() as ArrayType;
var isRefTypeArray = arrayType != null && var.Namespace is Class @class && @class.IsRefType;
var elementType = arrayType?.Type.Desugar();
if (!isRefTypeArray && elementType == null)
ctx.ReturnVarName = $"*{ptr}";
else if (elementType == null || elementType.IsPrimitiveType() ||
@ -3238,18 +3226,17 @@ namespace CppSharp.Generators.CSharp @@ -3238,18 +3226,17 @@ namespace CppSharp.Generators.CSharp
if (library != null)
libName = Path.GetFileNameWithoutExtension(library.FileName);
if (Options.StripLibPrefix && libName != null && libName.Length > 3 &&
if (Options.StripLibPrefix && libName?.Length > 3 &&
libName.StartsWith("lib", StringComparison.Ordinal))
{
libName = libName.Substring(3);
}
if (libName == null)
libName = declaration.TranslationUnit.Module.SharedLibraryName;
var targetTriple = Context.ParserOptions.TargetTriple;
if (Options.GenerateInternalImports)
libName = "__Internal";
else if (TargetTriple.IsWindows(targetTriple) &&
else if (targetTriple.IsWindows() &&
libName.Contains('.') && Path.GetExtension(libName) != ".dll")
libName += ".dll";

2
tests/CSharp/CSharp.Tests.cs

@ -804,7 +804,7 @@ public unsafe class CSharpTests : GeneratorTestFixture @@ -804,7 +804,7 @@ public unsafe class CSharpTests : GeneratorTestFixture
[Test]
public void TestTemplateCopyConstructor()
{
using (var original = new IndependentFields<int>(5))
using (var original = new IndependentFields<int>(5.0f))
{
using (var copy = new IndependentFields<int>(original))
{

16
tests/CSharp/CSharp.cpp

@ -1153,6 +1153,10 @@ int OverrideFromIndirectSecondaryBase::property() @@ -1153,6 +1153,10 @@ int OverrideFromIndirectSecondaryBase::property()
return 1;
}
TestOutTypeInterfaces::TestOutTypeInterfaces()
{
}
void TestOutTypeInterfaces::funcTryInterfaceTypePtrOut(CS_OUT TestParamToInterfacePassBaseTwo* classTry)
{
}
@ -1578,6 +1582,18 @@ DLL_API int useDuplicateDeclaredStruct(DuplicateDeclaredStruct* s) @@ -1578,6 +1582,18 @@ DLL_API int useDuplicateDeclaredStruct(DuplicateDeclaredStruct* s)
return s->i;
}
ComplexArrayElement::ComplexArrayElement() : BoolField(false), IntField(0), FloatField(0)
{
}
HasComplexArray::HasComplexArray()
{
}
TestIndexedProperties::TestIndexedProperties() : field(0)
{
}
void useStdStringJustAsParameter(std::string s)
{
}

8
tests/CSharp/CSharp.h

@ -857,6 +857,7 @@ public: @@ -857,6 +857,7 @@ public:
class DLL_API TestOutTypeInterfaces
{
public:
TestOutTypeInterfaces();
void funcTryInterfaceTypePtrOut(CS_OUT TestParamToInterfacePassBaseTwo* classTry);
void funcTryInterfaceTypeOut(CS_OUT TestParamToInterfacePassBaseTwo classTry);
};
@ -1252,8 +1253,9 @@ struct StructTestArrayTypeFromTypedef @@ -1252,8 +1253,9 @@ struct StructTestArrayTypeFromTypedef
#define MY_MACRO_TEST2_4 (1 << 3)
#define MY_MACRO_TEST2_ALL (1 << 4) - 1
struct ComplexArrayElement
struct DLL_API ComplexArrayElement
{
ComplexArrayElement();
bool BoolField;
uint32_t IntField;
float FloatField;
@ -1261,14 +1263,16 @@ struct ComplexArrayElement @@ -1261,14 +1263,16 @@ struct ComplexArrayElement
#define ARRAY_LENGTH_MACRO 10
struct HasComplexArray
struct DLL_API HasComplexArray
{
HasComplexArray();
ComplexArrayElement complexArray[ARRAY_LENGTH_MACRO];
};
class DLL_API TestIndexedProperties
{
public:
TestIndexedProperties();
mutable int field;
int operator[](const int& key);
void* operator[](size_t n) const;

8
tests/CSharp/CSharpTemplates.cpp

@ -4,6 +4,10 @@ T1::T1() @@ -4,6 +4,10 @@ T1::T1()
{
}
T1::T1(const T1& other) : field(other.field)
{
}
T1::T1(int f)
{
field = f;
@ -18,6 +22,10 @@ int T1::getField() const @@ -18,6 +22,10 @@ int T1::getField() const
return field;
}
T2::T2()
{
}
DerivedFromSpecializationOfUnsupportedTemplate::DerivedFromSpecializationOfUnsupportedTemplate()
{
}

3
tests/CSharp/CSharpTemplates.h

@ -14,6 +14,7 @@ class DLL_API T1 @@ -14,6 +14,7 @@ class DLL_API T1
{
public:
T1();
T1(const T1& other);
T1(int f);
~T1();
int getField() const;
@ -23,6 +24,8 @@ private: @@ -23,6 +24,8 @@ private:
class DLL_API T2
{
public:
T2();
};
class DLL_API Ignored

8
tests/Common/Common.Tests.cs

@ -1075,10 +1075,10 @@ This is a very long string. This is a very long string. This is a very long stri @@ -1075,10 +1075,10 @@ This is a very long string. This is a very long string. This is a very long stri
using (var nonPrimitiveFixedArray = new TestFixedNonPrimitiveArrays())
{
nonPrimitiveFixedArray.NonPrimitiveTypeArray = new NonPrimitiveType[]
{
new NonPrimitiveType{ foo = 1 },
new NonPrimitiveType{ foo = 2 },
new NonPrimitiveType{ foo = 3 }
{
new NonPrimitiveType { foo = 1 },
new NonPrimitiveType { foo = 2 },
new NonPrimitiveType { foo = 3 }
};
Assert.AreEqual(3, nonPrimitiveFixedArray.NonPrimitiveTypeArray.Length);

46
tests/Common/Common.cpp

@ -50,6 +50,10 @@ Foo::Foo() @@ -50,6 +50,10 @@ Foo::Foo()
SomePointerPointer = &SomePointer;
}
Foo::Foo(const Foo& other) : A(other.A), B(other.B)
{
}
Foo::Foo(Private p)
{
}
@ -94,6 +98,8 @@ char16_t Foo::returnChar16() @@ -94,6 +98,8 @@ char16_t Foo::returnChar16()
Foo2::Foo2() {}
Foo2::Foo2(const Foo2& other) : Foo(other), C(other.C), valueTypeField(other.valueTypeField) {}
Foo2 Foo2::operator<<(signed int i)
{
Foo2 foo;
@ -149,6 +155,10 @@ bool operator ==(Bar::Item item, const Bar& bar) @@ -149,6 +155,10 @@ bool operator ==(Bar::Item item, const Bar& bar)
return item == bar.RetItem1();
}
Bar2::Nested::Nested()
{
}
Bar2::Nested::operator int() const
{
return 300;
@ -405,6 +415,10 @@ Ex2* DerivedException::clone() @@ -405,6 +415,10 @@ Ex2* DerivedException::clone()
return 0;
}
DefaultParameters::DefaultParameters()
{
}
void DefaultParameters::Foo(int a, int b)
{
}
@ -421,6 +435,10 @@ void DefaultParameters::Bar() @@ -421,6 +435,10 @@ void DefaultParameters::Bar()
{
}
common::common()
{
}
int test(common& s)
{
return 5;
@ -826,9 +844,17 @@ Bar& TestIndexedProperties::operator[](const Foo& key) @@ -826,9 +844,17 @@ Bar& TestIndexedProperties::operator[](const Foo& key)
return bar;
}
TestVariables::TestVariables()
{
}
int TestVariables::VALUE;
void TestVariables::SetValue(int value) { VALUE = value; }
TestWideStrings::TestWideStrings()
{
}
InternalCtorAmbiguity::InternalCtorAmbiguity(void* param)
{
// cause a crash to indicate this is the incorrect ctor to invoke
@ -938,11 +964,19 @@ void ChangedAccessOfInheritedProperty::setProtectedProperty(int value) @@ -938,11 +964,19 @@ void ChangedAccessOfInheritedProperty::setProtectedProperty(int value)
{
}
ReturnsEmpty::ReturnsEmpty()
{
}
Empty ReturnsEmpty::getEmpty()
{
return Empty();
}
RefTypeClassPassTry::RefTypeClassPassTry()
{
}
void funcTryRefTypePtrOut(CS_OUT RefTypeClassPassTry* classTry)
{
}
@ -1307,6 +1341,10 @@ DerivedCovariant::~DerivedCovariant() @@ -1307,6 +1341,10 @@ DerivedCovariant::~DerivedCovariant()
{
}
NonPrimitiveType::NonPrimitiveType()
{
}
int NonPrimitiveType::GetFoo()
{
return foo;
@ -1316,6 +1354,14 @@ TestFixedNonPrimitiveArrays::TestFixedNonPrimitiveArrays() @@ -1316,6 +1354,14 @@ TestFixedNonPrimitiveArrays::TestFixedNonPrimitiveArrays()
{
}
TestGetterSetterToProperties::TestGetterSetterToProperties()
{
}
PointerToTypedefPointerTest::PointerToTypedefPointerTest()
{
}
void DLL_API PointerToTypedefPointerTestMethod(LPPointerToTypedefPointerTest* lp, int valToSet)
{
(*(*lp)).val = valToSet;

20
tests/Common/Common.h

@ -84,6 +84,7 @@ public: @@ -84,6 +84,7 @@ public:
};
Foo();
Foo(const Foo& other);
Foo(Private p);
Foo(const float& f);
int A;
@ -147,6 +148,7 @@ class DLL_API Foo2 : public Foo @@ -147,6 +148,7 @@ class DLL_API Foo2 : public Foo
public:
Foo2();
Foo2(const Foo2& other);
int C;
@ -165,6 +167,7 @@ struct DLL_API Bar2 : public Bar @@ -165,6 +167,7 @@ struct DLL_API Bar2 : public Bar
struct DLL_API Nested
{
Nested();
operator int() const;
};
@ -304,6 +307,7 @@ struct DLL_API DerivedException : public Exception @@ -304,6 +307,7 @@ struct DLL_API DerivedException : public Exception
// Tests for ambiguous call to native functions with default parameters
struct DLL_API DefaultParameters
{
DefaultParameters();
void Foo(int a, int b = 0);
void Foo(int a);
@ -326,7 +330,8 @@ class Derived : public Base<Derived> @@ -326,7 +330,8 @@ class Derived : public Base<Derived>
// Tests the MoveFunctionToClassPass
class DLL_API common
{
public:
common();
};
DLL_API int test(common& s);
@ -724,6 +729,7 @@ int TestIndexedPropertiesInValueType::operator[](int i) { return i; } @@ -724,6 +729,7 @@ int TestIndexedPropertiesInValueType::operator[](int i) { return i; }
// Tests variables
struct DLL_API TestVariables
{
TestVariables();
static int VALUE;
void SetValue(int value = VALUE);
};
@ -731,6 +737,7 @@ struct DLL_API TestVariables @@ -731,6 +737,7 @@ struct DLL_API TestVariables
typedef const wchar_t * LPCWSTR;
struct DLL_API TestWideStrings
{
TestWideStrings();
LPCWSTR GetWidePointer();
LPCWSTR GetWideNullPointer();
};
@ -771,8 +778,8 @@ TestArraysPointers::TestArraysPointers(MyEnum *values, int count) @@ -771,8 +778,8 @@ TestArraysPointers::TestArraysPointers(MyEnum *values, int count)
class DLL_API NonPrimitiveType
{
public:
NonPrimitiveType();
int GetFoo();
int foo;
@ -787,6 +794,7 @@ public: @@ -787,6 +794,7 @@ public:
struct DLL_API TestGetterSetterToProperties
{
TestGetterSetterToProperties();
int getWidth();
int getHeight();
};
@ -951,7 +959,11 @@ public: @@ -951,7 +959,11 @@ public:
} ct;
};
class DLL_API RefTypeClassPassTry { };
class DLL_API RefTypeClassPassTry
{
public:
RefTypeClassPassTry();
};
void DLL_API funcTryRefTypePtrOut(CS_OUT RefTypeClassPassTry* classTry);
void DLL_API funcTryRefTypeOut(CS_OUT RefTypeClassPassTry classTry);
@ -994,6 +1006,7 @@ class DLL_API Empty @@ -994,6 +1006,7 @@ class DLL_API Empty
class DLL_API ReturnsEmpty
{
public:
ReturnsEmpty();
Empty getEmpty();
};
@ -1608,6 +1621,7 @@ QScopedPointer<QObjectData> d_ptr; @@ -1608,6 +1621,7 @@ QScopedPointer<QObjectData> d_ptr;
struct DLL_API PointerToTypedefPointerTest
{
PointerToTypedefPointerTest();
int val;
};
typedef PointerToTypedefPointerTest *LPPointerToTypedefPointerTest;

4
tests/NamespacesDerived/NamespacesDerived.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using System.IO;
using System.Reflection;
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Utils;
@ -24,7 +25,8 @@ namespace CppSharp.Tests @@ -24,7 +25,8 @@ namespace CppSharp.Tests
module.IncludeDirs.Add(Path.GetFullPath(GetTestsDirectory(@base)));
module.Headers.Add($"{@base}.h");
module.OutputNamespace = @base;
module.SharedLibraryName = $"{@base}.Native";
module.LibraryDirs.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
module.Libraries.Add($"{@base}.Native");
driver.Options.Modules[1].Dependencies.Add(module);
}

Loading…
Cancel
Save