Dimitar Dobrev
c36145b29d
Bind default constructors with dependent pointers
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
0255eb732d
Resolve overloads with typedef-ed mapped params
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
77e9d0cc75
Ignore a test which only fails with the Linux CI
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Albert Szilvasy
24b02e4d86
Fix incorrect dtor call for non-owned instances ( #1615 )
...
* Introduce failing test for disposing bug
* Dispose(bool, bool) really shouldn't be public. Clients should call Dipose() instead.
Derived classes may need to call Dispose(bool, bool) so lets make it internal protected.
4 years ago
Joe Hull
748b7b5d03
Add a mechanism to selectively initialize allocated unmanaged memory in the default constructor.
...
* feature: Add a mechanism to selectively initialize unmanaged memory in the default constructor. (C# Only at this point).
* Use the global:: prefix when calling InitBlock
4 years ago
Joe Hull
b3a7cd0261
Much improved support for marshaling const char* to string
...
* Changed support for marshaling "const char *"s as strings so that:
1) CppSharp.Types.Std.CSharpMarshalToNative generates setters that allocate unmanaged memory for the native bytes rather than an unpinned pointer into managed memory. Also set a null termination char.
2) Add tracking for when unmanaged memory is allocated for "const char *" strings. Free it when reassigned or dispsoed.
3) Added explicit support for Encoding.Default for ANSI support.
4) Allow setting a string value to null.
* Added test to prove that the unpinned ptr to managed memory approach wasn't working, and that the new approach appears to work.
* Change CSharpSources.GenerateDisposeMethods to free unmanaged memory held by IntPtr's corresponding to "const char *" strings.
* Changed copy constructor to deep-copy owned string refs to avoid ref counting.
* Update CSharpSources.GenerateFieldGetter to treat Char16 and Char32 the same as WideChar to avoid compilation errors on the generated sources if char32_t or char16_t are used.
* Added tests.
* Workaround for mac C++ compilation issue.
4 years ago
Joe Hull
03bf194b63
Enhanced ExpressionEvaluator to return implicitly typed uint, long, and ulong values from EvaluateNumber when there is no literal type suffix applied to a numeric expression string.
...
Changed Library.GenerateEnumFromMacro and friends to track the primitive type of the Enumeration while building an Enumeration's list of items so that we can support negative items within an Enumeration.
Fixed bugs in GetUnderlyingTypeForEnumValue where "<" should have been "<=" and Long should have been LongLong. Extended it to support negative values.
Added tests.
4 years ago
Joe Hull
eb0d4c15f1
bug fix: When generating the get accessor for a field composed of an embedded array of structs use __GetOrCreateInstance to initialize the managed array wrapper rather than __CreateInstance so that __Instance holds a pointer to the memory allocated for the array in the outer struct rather than an independent copy of that memory.
...
Added a test.
TODO: once allocated, we may want to cache the managed array. Does this
issue exist in other generators as well?
4 years ago
Joe Hull
d135ffdb86
bug: Repaired broken alignment padding generation for structs with embedded arrays of structs. Added a test for this case.
4 years ago
Dimitar Dobrev
4405525f3a
Make unit tests independent of the generator
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
josetr
f474a7327b
Fix typo and move alignment offsets to cpp file
5 years ago
josetr
dbbcb6dbdf
Upgrade to .NET Core 3.1 and improve build system
5 years ago
josetr
f3830b0b2a
Ignore testing the incorrect marshalling of parameters typed const& to primitives
...
See https://github.com/mono/CppSharp/issues/1518 for details. .NET Core exposes this bug which seems to have worked on .NET Framework by pure chance.
5 years ago
josetr
42dda6b12f
Fix generation of SequentialLayout structures ( #1499 )
5 years ago
josetr
7791cf6996
Fallback to LayoutKind.Explicit when a custom alignment is specified. ( #1476 )
5 years ago
josetr
0d32121eee
Fix the generation of sequential layouts
5 years ago
josetr
e61e9201ec
Fix ambiguous conversion functions ( #1458 )
5 years ago
josetr
a6e0595428
Remove unsupported calling convention usage ( #1454 )
...
* Remove unsupported calling convention usage
* Remove empty #define
* Move method implementation to source file
5 years ago
josetr
8c4465bb11
Fix PInvokeStackImbalance when calling C++ methods ( #1453 )
...
* Fix PInvokeStackImbalance when calling C++ methods
5 years ago
josetr
832e4e9eb0
Fix IntPtr array marshalling bug and move hard to read code to CppSharp.Runtime ( #1446 )
5 years ago
josetr
37c0164072
Add support for const char32_t* and fix const wchar_t* in linux / osx ( #1444 )
...
* Add support for const char32_t* and fix const wchar_t* in linux / osx
5 years ago
josetr
41f0e9f72b
Fix marshalling for bool arrays ( #1439 )
...
* Fix marshalling for bool arrays
5 years ago
josetr
c3ca3c241b
Fix wrong [MarshalAs(UnmanagedType)] for strings ( #1438 )
5 years ago
josetr
6496bf8dae
Basic support for static constexpr variables ( #1435 )
...
Basic support for static constexpr variables
5 years ago
josetr
397811dc3c
Fix wrong marshalling for static member arrays ( #1428 )
...
* Fix wrong marshalling for static member arrays
5 years ago
josetr
73670debbc
Fix anonymous member name colliding with enclosing type name ( #1425 )
...
* Fix anonymous member name colliding with enclosing type name
5 years ago
Dimitar Dobrev
b5ca0635be
Check symbols in tests
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
29c6eb5625
Test overriding from a secondary base for Itanium
...
Fixes https://github.com/mono/CppSharp/issues/1364 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
fd15ab6632
Make a test localization-independent of the IDE
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
6fd9078445
Fix the regressed C# marshalling of char*
...
Fixes https://github.com/mono/CppSharp/issues/1258 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
7b6fb6e340
Implement abstract templates to call virtuals
...
This allows for, just as with regular classes, the calling of virtual methods of abstract templates returned by functions.
Fixes https://github.com/mono/CppSharp/issues/1270 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
8dfcd5b717
Fix all memory leaks in tests
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
d3a3484c35
Fix a crash for secondary bases with secondary bases
...
The test has also uncovered a bug where the call to a primary base isn't always adjusted so the fix is extended accordingly.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
d2ebabbebe
Restore mapping of overloaded getters to methods
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
914b977dfd
Optimize the pass for properties
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
573272e855
Generate valid C# when a renamed override causes conflicts
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
d9a33bac7b
Ensure protected nested types are accessible with multiple inheritance
...
Fixes #594 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
1792f529ff
Fix the getting of references to pointers in C#
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
62fc6f90d9
Fix the passing of references to pointers in C#
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
fac861ad8d
Make indexers use non-trivial copy ctors if any
...
Fixes #1229 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
547a9f2819
Fix the passing of std::string by value
...
std::string has a non-trivial copy constructor which was erroneously ignored.
Fixes #867 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
153a4d095b
Guard against null for objects passed by value
...
Fixes #1228
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
3cd7fdee25
Generate valid C# for implicit conversion to const char*
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
f810ca63b2
Generate valid C# when passing a const ref to char
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
caed19e863
Generate valid C# when a secondary base has a public anonymous field
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
64773a5f6f
Generate valid C# for template parameters with a default value
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
1fc1b4ec51
Fix default arguments to only map to null if pointers
...
This bug is revealed by properly fixing the reading of ABI parameters in the parser.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
458293edfc
Generate valid C# for returned const void pointers
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
43c17f9946
Generate valid C# for r-values to void pointers
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Joao Matos
53816286bc
Fixed type map support for typedef types.
...
Fixes https://github.com/mono/CppSharp/issues/1205 .
6 years ago