summaryrefslogtreecommitdiff
path: root/Lib/csharp
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup SWIG_VERSION definitionWilliam S Fulton2022-10-131-2/+0
| | | | | | | | | | | | | Add Swig_obligatory_macros which must be called by each target language to define SWIG_VERSION correctly in the generated code, as well as the language specific macro SWIGXXX where XXX is the target language name. Drop the #ifdef SWIGXXX that was previously generated - I can't see the point of this and if users are defining this macro somehow, then users will need to change this Closes #1050
* Sort out predefined SWIG-specific macrosOlly Betts2022-10-051-0/+2
| | | | | | | | | | | | | | | | | | | Ensure that SWIG_VERSION is defined both at SWIG-time and in the generated C/C++ wrapper code (it was only defined in the wrapper for some target languages previously). SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers to match behaviour for all other target languages. Stop defining SWIGVERSION in the wrapper. This only happened as a side-effect of how SWIG_VERSION was defined but was never documented and is redundant. The new testcase also checks that SWIG is defined at SWIG-time but not in the generated wrapper, and that exactly one of a list of target-language specific macros is defined. Fixes #1050
* C# CreateWStringFromUTF32 optimisationWilliam S Fulton2022-09-301-3/+1
| | | | | Avoid UTF-32 to UTF-8 conversion then get string from UTF-8 Missing change that should have gone into eaf468e9e8d3ef17f397ef6bc5e73807a2bf3594
* C# CreateWStringFromUTF32 optimisationWilliam S Fulton2022-09-221-2/+1
| | | | | Avoid UTF-32 to UTF-8 conversion then get string from UTF-8 Issue #2369
* Add missing typecheck typemaps for std::auto_ptr and std::unique_ptrWilliam S Fulton2022-09-172-0/+4
| | | | To fix overloading when using these types.
* Provide SWIGTYPE MOVE typemaps in swigmove.iWilliam S Fulton2022-09-161-0/+16
| | | | | | | | | | | | For implementing full move semantics when passing parameters by value. Based on SWIGTYPE && and std::unique_ptr typemaps which implement move semantics. Added for all languages, but untested for: Go, Ocaml, R, Scilab (and unlikely to be fully functional for same reasons as for std::unique_ptr support). Issue #999
* SWIGTYPE && input typemaps now assume object has been movedWilliam S Fulton2022-08-311-5/+7
| | | | | | | | | | | | | | | | | | | | Replicated Java implementation. Fully implemented for: - C# - D - Guile - Javascript (UTL) - Lua - MzScheme - Octave (UTL) - Perl (UTL) - PHP - Python (UTL) - Ruby (UTL) - Tcl (UTL) PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
* Cosmetic stray semi-colon removal after %typemap using quotesWilliam S Fulton2022-08-315-5/+5
|
* Add support for std::auto_ptr inputsWilliam S Fulton2022-07-181-11/+20
| | | | Ported from std::unique, behaviour is identical with regard to memory ownership/handling
* Cosmetic formatting and doc updates in std_unique_ptr.i filesWilliam S Fulton2022-07-171-10/+13
|
* Add C# support std::unique_ptr inputsWilliam S Fulton2022-07-173-3/+39
| | | | Based on Java implementation.
* More move semantics improvementsWilliam S Fulton2022-07-042-4/+4
| | | | | More removal of casts in the out typemaps when copying objects to enable C++ compilers to possibly make use of move semantics.
* Performance optimisation for directors for classes passed by valueWilliam S Fulton2022-07-042-2/+2
| | | | | | | The directorin typemaps in the director methods now use std::move on the input parameter when copying the object from the stack to the heap prior to the callback into the target language, thereby taking advantage of move semantics if available.
* Cosmetic changes to auto_ptr library filesWilliam S Fulton2022-07-021-12/+14
|
* Add std::unique supportWilliam S Fulton2022-07-021-0/+27
| | | | | | | Simple copy of current auto_ptr support (just suppport for functions returning std::unique_ptr). Closes #1722
* Movable and move-only types supported in "out" typemaps.William S Fulton2022-06-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhance SWIGTYPE "out" typemaps to use std::move when copying objects, thereby making use of move semantics when wrapping a function returning by value if the returned type supports move semantics. Wrapping functions that return move only types 'by value' now work out the box without having to provide custom typemaps. The implementation removed all casts in the "out" typemaps to allow the compiler to appropriately choose calling a move constructor, where possible, otherwise a copy constructor. The implementation alsoand required modifying SwigValueWrapper to change a cast operator from: SwigValueWrapper::operator T&() const; to #if __cplusplus >=201103L SwigValueWrapper::operator T&&() const; #else SwigValueWrapper::operator T&() const; #endif This is not backwards compatible for C++11 and later when using the valuewrapper feature if a cast is explicitly being made in user supplied "out" typemaps. Suggested change in custom "out" typemaps for C++11 and later code: 1. Try remove the cast altogether to let the compiler use an appropriate implicit cast. 2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the __cplusplus macro if all versions of C++ need to be supported. Issue #999 Closes #1044 More about the commit: Added some missing "varout" typemaps for Ocaml which was falling back to use "out" typemaps as they were missing. Ruby std::set fix for SwigValueWrapper C++11 changes.
* Add C# wchar_t * director typemapsWilliam S Fulton2022-05-041-1/+10
| | | | More Python std::wstring directors Python testing
* C# std::wstring director supportWilliam S Fulton2022-05-041-3/+3
| | | | Updates for #1706
* Fix line endingstartanpaint2022-05-041-4/+4
|
* Fix marshalling of std::wstring parameters in directorstartanpaint2022-05-041-2/+6
| | | | std::wstring parameters on SWIG directors were being truncated to a single character due to marshalling inconsistencies. This patch applies the same MarshalAs(UnmanagedType.LPWStr) attribute to director delegate methods and allows std::wstrings to be successfully received in the C# code via director calls.
* Add support for throwing wstring exceptionsWilliam S Fulton2022-05-022-5/+72
| | | | Throw an ApplicationException for std::wstring and wchar_t * strings
* wchar_t C# marshalling tweakWilliam S Fulton2022-05-022-12/+15
| | | | | Use more appropriate unsigned short (2 byte type) pointer for C# ctype instead of wchar_t pointer
* Add support for wchar_t * and std::wstring Unicode strings on LinuxWilliam S Fulton2022-05-022-25/+203
| | | | | | Initial contributions for Linux provided in issue #1233, modified to work on both Windows and Linux. Dual support is possible by detecting the sizeof wchar_t which is different on each of these systems.
* Fix CS0034 in Capacity method of std::vectorgteubl2022-03-181-1/+1
|
* More director const std::string& testing and C# leak fixWilliam S Fulton2022-02-131-2/+2
| | | | Issue #998
* Avoid -Wempty-body warnings from SWIG_contract_assertOlly Betts2022-02-111-1/+1
|
* Renames performed by `%namewarn` with `rename=` are printed in warning messageSeth R Johnson2022-02-061-2/+2
| | | | | | This is necessary for regex-like renames (where you can't use the #define trick as is done in many of the %keywordwarn directives). It's now unnecessary to print the "renaming to '`x`'" code explicitly by the kw.swg files.
* [C#] Fix memory leak in directorin typemap for std::string.Olly Betts2022-02-031-2/+2
| | | | Fixes #998
* Fix more "allows to" and other typosOlly Betts2021-04-211-1/+1
|
* Add access modifier support for interface featureWilliam S Fulton2020-09-251-0/+1
| | | | | | | | | | | | | | Add ability to change the modifiers for the C# and Java interface generated when using the %interface macros. For C# use the 'csinterfacemodifiers' typemap. For Java use the 'javainterfacemodifiers' typemap. For example: %typemap(csinterfacemodifiers) X "internal interface" Closes #1874
* Fix C# wchar_t* csvarout to be same as csoutGareth Francis2020-09-051-1/+1
|
* Add C# support for void *VOID_INT_PTR member variablesWilliam S Fulton2020-08-131-0/+9
| | | | Issue reported by Carlos Frederico Biscaya on swig-user mailing list.
* Add note about wchar_t marshalling fix required for WindowsWilliam S Fulton2019-07-251-1/+1
|
* fix undesirable `wstring` encoding at return value marshalling for C#smithx2019-07-221-1/+4
|
* fix undesirable `wstring` encoding at return value marshalling for C#smithx2019-07-222-1/+5
|
* Merge branch 'bugfix/616-csharp-bool-array'William S Fulton2019-07-161-1/+41
|\ | | | | | | | | | | | | | | * bugfix/616-csharp-bool-array: Add changes entry to fix C# bool[] Quieten failing bool[] testcase message Skip failing bool[] test cases when running under mono Change C# bool[] typemaps to marshall as 1-byte
| * Change C# bool[] typemaps to marshall as 1-byteGareth Francis2019-07-061-1/+41
| | | | | | | | | | | | | | | | | | Default marshalling for bool[] now uses 1-byte entries in the array, to ensure array contents is as expected in C++. When running under mono csharp_lib_arrays_bool testcase will fail due to an apparent bug in mono. Works correctly under Microsoft's runtime. See https://github.com/mono/mono/issues/15592
* | Allow std::set<> C# typemaps to work for non-nullable types tooVadim Zeitlin2019-07-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notably make them work for primitive types, such as "int". Doing this requires using "object" instead of the actual C# type of the variable to store the current value in the iterator, as we don't currently have a "csnullabletype" typemap that would expand to "T" for nullable types and "T?" for the other ones. This is a bit ugly, but it shouldn't matter much for the generated code and is already done in std::vector<> typemaps. Also add a simple unit test verifying the basic functionality for such vectors. Closes #1568.
* | Replace leftover string with the proper type in C# set typemapVadim Zeitlin2019-07-111-1/+1
|/ | | | | | | | This is just a mistake remaining from generalizing the old string-specific typemap to any type. Fix it now and update a unit test to test for sets of objects other than strings.
* Java/C# std::vector<bool> workarounds for clangWilliam S Fulton2019-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Workaround clang++ 9.1.0 error not knowing std::vector<bool>::const_reference is actually typedef to bool: li_std_vector_wrap.cxx:1838:40: error: no matching constructor for initialization of 'std::vector<bool>::const_reference' Workaround is use const value_type& getitem(int index) throw (std::out_of_range) { ... // bool specialization: bool getitem(int index) throw (std::out_of_range) { ... instead of const_reference_type getitem(int index) throw (std::out_of_range) { ... Although the following would be better, it would require a more complicated implementation: const_reference_type getitem(int index) throw (std::out_of_range) { ... // bool specialization: bool getitem(int index) throw (std::out_of_range) { ...
* Improve backwards compatibility in C#/Java std::array wrappersWilliam S Fulton2019-04-191-2/+2
| | | | For users who have typemaps for the parameters in the setitem or set methods.
* Improve backwards compatibility in C# std::vector wrappersWilliam S Fulton2019-04-191-6/+6
| | | | | | For users who have typemaps for the parameters in the setitem method. Correct definitions of const_reference to match the those in the (C++11) standard.
* Fix C# wrappers FxCop warning CA2002 in SWIGPendingExceptionWilliam S Fulton2019-04-091-2/+7
| | | | | | | | | | | Fixes two warnings in each wrapper: warning : CA2002 : Microsoft.Reliability : 'examplePINVOKE.SWIGPendingException.Retrieve()' locks on a reference of type 'Type'. Replace this with a lock against an object with strong-identity. warning : CA2002 : Microsoft.Reliability : 'examplePINVOKE.SWIGPendingException.Set(Exception)' locks on a reference of type 'Type'. Replace this with a lock against an object with strong-identity. Use lock statement advice not to use typeof for locks, see https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/lock-statement
* Fix C# CA1063 warning by implementing the recommended Dispose methods.William S Fulton2019-04-083-22/+21
| | | | | | | | | | | | | | | Previously just the Dispose() method was generated. Now the Dispose() and Dispose(bool disposing) methods are generated. Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived" typemaps are being used. Details in #421 on Github. SWIG will error out if one of the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example error message: foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps. Closes #421
* Replace void* with iterator* in C# std::list wrappersWilliam S Fulton2019-03-251-37/+33
| | | | | | Better to use the actual type rather than void* in the implementaton. It also mean the %apply that was used in the implementation won't inadvertently affect users other use of void* types.
* C# std::list changes to support types that are not assignableWilliam S Fulton2019-03-252-48/+83
| | | | | | | | | | | | Assignable fixes are based on those used by C# std::vector where the default wrappers work if there is no operator== available in the template type. Enhanced wrappers are obtained via a macro: SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass) %template(ListKlass) std::list<SomeNamespace::Klass>; Remove bool specialization (left over from the original std::vector wrappers). Add in missing typedefs.
* C# - add std::listAdrien JUND2019-03-251-0/+483
|
* Fix header comment in C# std_set typemapsVadim Zeitlin2019-03-111-3/+7
| | | | Mention that these typemaps require .NET 4 or greater.
* Implement set-theoretic methods in std::set C# typemapsVadim Zeitlin2019-03-111-10/+78
| | | | | | These implementations are not optimized, i.e. are done in a naive way in C#, rather than using C++ functions more efficiently, but are better than nothing.
* Add std::set<> typemaps for C#Vadim Zeitlin2019-03-111-0/+239
| | | | | | | | Create new Lib/csharp/std_set.i based on the existing std_map.i and run li_std_set unit test for C# as well. Notice that the set operations defined by the base ISet<> interface are not implemented yet.