Salvage
ebe6b8a415
Fix value type out parameters
2 years ago
Trung Nguyen
357efec91b
Array marshalling ( #1748 )
...
* Generator: Customization for const char[]
Allow the user to choose whether `const char[]` should be marshalled as
`string` or a normal `char` array in C#.
A new option `MarshalConstCharArrayAsString` is added, and is `true`
by default.
This helps in situations where the original C++ API distinguishes
between C-strings and char arrays using the two different notations.
* CSharpMarshal: Fix unknown length array marshal
For unknown length arrays, also run a conversion loop if the primitive
type encountered needs conversion (e.g. `char` to `sbyte`).
* CSharpTypePrinter: Fix for boolean arrays
2 years ago
josetr
567a0df8c7
Fix FunctionToInstanceMethod
3 years ago
josetr
efdec41f13
Add missing GenerateNativeToManagedFor checks
3 years ago
josetr
eb5031bf4c
Format files
3 years ago
Ahmed Elsayed
c281f57b52
Add Experimental Initial Span ( #1651 )
...
* Fix NotImplementedException
* Add Experimental Span
* Fix Some Problems and Comment
3 years ago
Dimitar Dobrev
0d84877068
Simplify code by not specially handling void**
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
c8c415b977
Generate valid C# for static object-typed fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
4649052f2c
Fix templated indexers returning objects
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
50feab050f
Free returned by value instances, not object ones
...
This was a dangerous bug by as the object remained in a deleted state to be used later.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
065ed82d2e
Remove the repetitive field for a type printer
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
6a0bdc1ba6
Delete the C++ copy when returning by value ( #1623 )
...
Fixes https://github.com/mono/CppSharp/issues/1600 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
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
Joao Matos
c4f96ab1b9
Factor VarPrefix and ArgumentPrefix helpers into base marshaler.
5 years ago
Dimitar Dobrev
0e38947e07
Convert the visiting options to an enum
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
josetr
75c0fbcbdf
Simplify the marshalling of returned pointers ( #1470 )
5 years ago
josetr
eac78c6caf
Improve generation of C# ( #1466 )
5 years ago
josetr
b9cf8f160a
Reduce calls to ConcurrentDictionary to improve performance ( #1464 )
5 years ago
josetr
832e4e9eb0
Fix IntPtr array marshalling bug and move hard to read code to CppSharp.Runtime ( #1446 )
5 years ago
josetr
133a1882df
Copy arrays of primitive values using System.Buffers.MemoryCopy ( #1440 )
5 years ago
josetr
41f0e9f72b
Fix marshalling for bool arrays ( #1439 )
...
* Fix marshalling for bool arrays
5 years ago
Dimitar Dobrev
2acbf32a96
Fix generation for fields of type const reference
...
Fixes https://github.com/mono/CppSharp/issues/1323 .
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
João Matos
55a31b05bf
CppTypePrinter now takes a BindingContext for further usage in type maps handling.
5 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
e430f6f8dc
Fix regressed indexers in templates with non-trivial ctors
...
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
f810ca63b2
Generate valid C# when passing a const ref to char
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
991c6ffb25
Generate valid C# for typedef-ed type parameters
...
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
9e21bcd022
Fix regressions with void pointers and references
...
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
Dimitar Dobrev
a9bfe1c31f
Support indirect parameters
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
0e56bc62e2
Generate valid C# for returned const char*&
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
9bc39c44ab
Generate valid C# for template indexers taking const char*
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
d5380fe890
Fix the generated C# for const char*&
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Joao Matos
850dcfaf67
Changed `CSharpTypePrinter.IntPtrType` to be a getter property.
6 years ago
Joao Matos
6dfd16ba9b
Move `CppTypePrinter` to generators and inherit from `TypePrinter`.
6 years ago
Dimitar Dobrev
5df67cd0c7
Fixed the generation for parameters of type void**.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
d97016fe3c
Fixed the generated C# for indexers in templates specialized with void*.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
cd32a449c8
Fixed the generated C# for template specializations of pointers.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
6602841a3c
Fixed the generated C# for const void*& in parameters.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
efa11ab745
Simplified type maps by unlinking them from declarations.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
a4913509eb
Added type maps for primitive strings (pointers to char).
...
const char*, const char16_t* and const wchar_t* in particular.
This enables comparison of types when resolving ambiguity.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
43bb2ee4bb
Added a type map for char.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
3b51325f0a
Deleted an unused member in type maps.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
760caf4d83
Simplified the logic for indentation by using numbers.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
b7d3d36ff1
Renamed members related to indentation for more clarity.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago