Dimitar Dobrev
9b90f1c77b
Generate valid C# for nested in external specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
c84a6c606e
Generate valid C# for independent external specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
aab63d0aa3
Generate valid C# for unresolvable base templates
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
69e766be5d
Generate valid C# for classes with dependent fields nested in templates with independent fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
a69f6d1d6d
Generate valid C++ for specialisations with void
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
5552f2b484
Generate valid C# for pure functions returning or taking dependent pointers
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 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
365b8db71c
Print C++ for some kinds of non-type template parameters
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
ad6557792f
Simplify handling of initialisation of variables
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
132ed7e25b
Generate valid C# for variables which use float
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
ac5001ddca
Generate valid C# for variables with > 1 arg
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
9a17dbee1b
Generate valid C++ for variadic functions
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
5e328da9e7
Fix C# layouts for classes with nameless unions
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
5a21a7facd
Generate valid C# for copy ctors with extra args
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
50cba5552c
Generate valid C# for destructors of templates with dependent fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
ac8bbee379
Don't generate or move ignored specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
09190268bc
Generate valid C# for internal fields of type external specialization
...
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
12f456e4c4
Trim specializations only used in ignored types
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
2da9e49fe8
Instantiate specialized classes nested in templates
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
4397cae7b2
Generate valid C++ for parameters by value
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
722a1d735d
Generate valid C++ for conversion operators in name-spaced classes
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
f97ad43ce4
Generate valid C# for base types with public fields of const char*
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
385c5e9387
Ensure valid C# for default args assigned secondary bases
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
42f38ec99e
Generate valid C# for constants in namespaceless modules
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
9c52adae09
Generate valid C# for types nested in external typedef-ed specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
f5bed3223d
Generate valid C# with explicit external specializations
...
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
6dfabb6273
Generate valid C# for specializations in default args
...
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
2fdd0822d2
Generate valid C# for setters returning Booleans
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
8803ede83d
Place returns as needed without an extra block
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
fe68d33cb4
Generate C++ deconflicted with system functions ( #1626 )
...
If a type shares a name with a system function, such as, well, "system()", declaring the type by name alone is taken as the function. So we need to prefix the type with "class" or "struct" as appropriate.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
7ead6b4574
Don't print tags for nameless and typedef classes
...
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
c6768bcac5
Fix C4099 (class as struct) in generated C++/CLI
...
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
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
Albert Szilvasy
a178108c06
Fix for Visual Studio 2019 16.10 ( #1614 )
4 years ago
Dimitar Dobrev
5c58a5993e
Generate valid C# for public fields of typedef-ed primitive pointer
...
Fixes https://github.com/mono/CppSharp/issues/1611 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
954a0cf941
Resolve names matching those of system functions
...
Fixes https://github.com/mono/CppSharp/issues/1602 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
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
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
e2c81df194
Fix a regression when printing C++ methods
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
4 years ago
Dimitar Dobrev
0e249d0986
Fix the regressed generation of C++ for variables
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Joao Matos
ee271371d3
Minor refactoring in CCodeGenerator.GetMethodIdentifier.
5 years ago
Joao Matos
c6e263e269
Add work-in-progress TypeScript interface bindings generator.
5 years ago
Joao Matos
28694431c7
C/C++ type printing fixes.
5 years ago