Activity for SWIG

  • Olly Betts Olly Betts posted a comment on ticket #1095

    This patch fixes the example here, but seems a bit of a hack as it just allows anything to be passed for this parameter, but with the lowest typecheck precedence. Ideally we should actually check for what's accepted her, though the in typemap allows anything so maybe that's actually correct: diff --git a/Lib/lua/lua_fnptr.i b/Lib/lua/lua_fnptr.i index b4c663c5..8e67d8fb 100644 --- a/Lib/lua/lua_fnptr.i +++ b/Lib/lua/lua_fnptr.i @@ -115,6 +115,9 @@ void swiglua_ref_get(SWIGLUA_REF* pref){ %} +%typemap(typecheck,...

  • William Fulton William Fulton modified ticket #884

    [csharp] getCPtr should use object.ReferenceEquals

  • William Fulton William Fulton posted a comment on ticket #884

    I'm not sure it will be easy to keep the code based maintained to always cover this corner case. The relevant typemaps can be easily changed by the user to use ReferenceEquals instead and so I'm closing as won't change. I can't there being a runtime overhead when there is no operator== overload.

  • William Fulton William Fulton created a blog post

    SWIG-4.2.1 released

  • SWIG SWIG released /swigwin/swigwin-4.2.1/swigwin-4.2.1.zip

  • SWIG SWIG released /swigwin/swigwin-4.2.1/readme-4.2.1.txt

  • SWIG SWIG released /swig/swig-4.2.1/readme-4.2.1.txt

  • SWIG SWIG released /swig/swig-4.2.1/swig-4.2.1.tar.gz

  • Olly Betts Olly Betts posted a comment on ticket #682

    Looks like https://github.com/swig/swig/issues/197 may be the same issue.

  • Olly Betts Olly Betts posted a comment on ticket #682

    Still reproducible with current git master. Also I came up with a much simpler reproducer: %module x %inline %{ typedef enum { BAZ1 } baz; void enumbugexample( baz const & ) { } %} Then: $ swig -c++ -python simplified.i $ grep 'enum baz' simplified_wrap.cxx enumbugexample((enum baz const &)*arg1); static swig_type_info _swigt__p_baz = {"_p_baz", "baz *|enum baz *", 0, 0, (void*)0, 0}; The const & seems to be needed. I notice the type info entry includes enum baz * which seems wrong too.

  • Olly Betts Olly Betts posted a comment on ticket #852

    I noticed the problem reported here is actually documented in the manual: https://www.swig.org/Doc4.2/SWIGPlus.html#SWIGPlus_namespaces Because namespaces are flattened, it is possible for symbols defined in different namespaces to generate a name conflict in the target language. For example: namespace A { void foo(int); } namespace B { void foo(double); } When this conflict occurs, you will get an error message that resembles this: example.i:26. Error. 'foo' is multiply defined in the generated...

  • Olly Betts Olly Betts posted a comment on ticket #852

    Still present in git shortly after 4.2.0. It also seems to fail even if %nspace N; is used with a target language with %nspace support.

  • Olly Betts Olly Betts posted a comment on ticket #1071

    Still reproducible with git master shortly after 4.2.0. Looking at this afresh, the two delete_v calls are OK as those are for the temporary v(1.1.1) and v(2,2,2) objects passed to the comp constructor. The essential problem here is that comp_a_get returns a Python v object which wraps a pointer to the C++ v a inside the temporary comp object, but then delete_comp is called before we call v_x_get on that v. For this to work it seems either a reference to comp needs to be kept by the v returned by...

  • Olly Betts Olly Betts posted a comment on ticket #1210

    Still happens with current git master (shortly after SWIG 4.2.0) except the error is now a TypeError: TypeError: Wrong number or type of arguments for overloaded function 'IntVec___setitem__'.

  • Olly Betts Olly Betts modified a comment on ticket #1167

    Still present in current git master (shortly after 4.2.0). SWIG now handles both these cases: void f(double param = i.d()); void f(double param = Outer::d()); However the case reported here with both a namespace and an object is still not handled.

  • Olly Betts Olly Betts posted a comment on ticket #1167

    Still present in current git master (shortly after 4.2.0). SWIG now handles both these cases, but still not the case reported here with both a namespace and an object: void f(double param = i.d()); ``` void f(double param = Outer::d()); ```

  • William Fulton William Fulton modified ticket #807

    Identifier warning for friend methods in a namespace

  • William Fulton William Fulton posted a comment on ticket #807

    Fixed in a6ab9145115aa124ff9c98e2b3c39fde9f205760

  • William Fulton William Fulton modified ticket #960

    Namespace breaks %ignore with unbound C++ operator<<

  • William Fulton William Fulton posted a comment on ticket #960

    Fixed by a6ab9145115aa124ff9c98e2b3c39fde9f205760. All 6 of the %ignore directives shown now work.

  • William Fulton William Fulton modified a blog post

    SWIG-4.2.0 released

  • William Fulton William Fulton modified a blog post

    SWIG-4.2.0 released

  • William Fulton William Fulton created a blog post

    SWIG-4.2.0 released

  • SWIG SWIG updated /swigwin/swigwin-4.2.0/readme-4.2.0.txt

  • SWIG SWIG updated /swig/swig-4.2.0/readme-4.2.0.txt

  • SWIG SWIG updated /swigwin/swigwin-4.2.0/swigwin-4.2.0.zip

  • SWIG SWIG updated /swig/swig-4.2.0/swig-4.2.0.tar.gz

  • SWIG SWIG released /swigwin/swigwin-4.2.0/swigwin-4.2.0.zip

  • SWIG SWIG released /swig/swig-4.2.0/swig-4.2.0.tar.gz

  • SWIG SWIG released /swig/swig-4.2.0/readme-4.2.0.txt

  • SWIG SWIG released /swigwin/swigwin-4.2.0/readme-4.2.0.txt

  • SWIG SWIG released /swigwin/swigwin-4.2.0-beta1/swigwin-4.2.0-beta1.zip

  • SWIG SWIG released /swig/swig-4.2.0-beta1/readme-4.2.0-beta1.txt

  • SWIG SWIG released /swigwin/swigwin-4.2.0-beta1/readme-4.2.0-beta1.txt

  • SWIG SWIG released /swig/swig-4.2.0-beta1/swig-4.2.0-beta1.tar.gz

  • Olly Betts Olly Betts modified ticket #1079

    Problems with long/jlong and int64_t on 64-bit platforms

  • Olly Betts Olly Betts posted a comment on ticket #1079

    This recent commit (which will be in SWIG 4.2.0) looks like it addresses the remaining points here: commit 7bba06b03ef4529c542c3cf8364c382027aae000 Author: William S Fulton <wsf@fultondesigns.co.uk> Date: Wed Sep 27 07:46:53 2023 +0100 Java - SWIGWORDSIZE64 for long type Defining SWIGWORDSIZE64 now applies the (unsigned) long long typemaps to (unsigned) long for a better match on systems where long is 64-bits. Although size_t typemaps are now applied from the int typemaps instead of the long typemaps,...

  • Olly Betts Olly Betts posted a comment on ticket #1012

    Reproducible with git master 29367b31c8202c5cbe72e05927d77004636d6af9. Running with -debug-module 1 then -debug-module 2 it seems this happens somewhere in between those two stages: +++ class - 0x7f9380f74810 ---------------------------------------- | allows_typedef - "1" | firstChild - 0x7f9380f74950 | kind - "class" | lastChild - 0x7f9380f74d70 | module - 0x7f9380f73b30 | name - "Parser::Parser" | parentNode - 0x7f9380f73c50 | previousSibling - 0x7f9380f74670 | sym:name - "Parser" | sym:overname...

  • Olly Betts Olly Betts posted a comment on ticket #884

    https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/how-to-define-value-equality-for-a-type seems to be the current version of the link wsfulton gave above.

  • Olly Betts Olly Betts posted a comment on ticket #1326

    where does that int come from? Oh, that's my fault - I was experimenting with the testcase and had added an int parameter before the ...! The other issues still seem to be the case with current git master.

  • Olly Betts Olly Betts posted a comment on ticket #887

    Still fails to parse with current git master.

  • Olly Betts Olly Betts posted a comment on ticket #1377

    Retesting with current git master I spotted a problem with how I was building the shared library - the reproducer still fails as given, but s/::ns/ns/g makes it work. So my "things seem to have got worse" above is bogus.

  • Olly Betts Olly Betts posted a comment on ticket #844

    I think that given this feature was removed 18 years ago we should just update the documentation to match reality. Reinstating these typemaps looks hard as they seem to use some magic via a parse typemap attribute which there's no longer any code to handle, and I can't see where it used to be handle, or any documentation as to what it did: %typemap(in,parse="I") int CONSTANT, unsigned int CONSTANT ""; I've remove the documentation in 10bab22248327642133fcb94a7a7c1eb5e041ab8. If someone wants to reinstate...

  • Olly Betts Olly Betts modified ticket #844

    [tcl] Constants and enums - apply rule not working

  • Olly Betts Olly Betts modified ticket #1134

    C++ memory leak of temporaries on exception

  • Olly Betts Olly Betts posted a comment on ticket #1134

    I fixed this same issue for Lua in 9ab9c716239d2855bdd6c0771e2e980c0767fb57, and https://github.com/swig/swig/issues/1981 is the same but for Go. There's a testcase exception_memory_leak for it so writing a _runme.pl for that would provide a regression test.

  • William Fulton William Fulton modified ticket #793

    Swig, perl5 and union

  • William Fulton William Fulton posted a comment on ticket #793

    The union variable name is called intRep and is an anonymous union, that is, it does not have any type name. It is thus not possible to create a type outside of Object to assign to intRep. Consider a small change to give the union a type name, say IntRepType as follows: typedef struct Object { int objtype; union IntRepType { int ivalue; double dvalue; char *strvalue; void *ptrvalue; } intRep; } Object; void tester() { /* approach (1) */ obj.intRep.dvalue = 1.23; /* approach (2) */ union IntRepType...

  • William Fulton William Fulton modified ticket #919

    c++ private assignment operator not obeyed for arrays

  • William Fulton William Fulton posted a comment on ticket #919

    Fixed in https://github.com/swig/swig/commit/650aad82ede59abe1a9355c274e213d33ae9d543.

  • William Fulton William Fulton modified ticket #1006

    swig tries to call private constructor

  • William Fulton William Fulton posted a comment on ticket #1006

    Fixed in https://github.com/swig/swig/commit/f11bffcb1993eb5435b093f2641f857ccb674a77.

  • Olly Betts Olly Betts modified ticket #1314

    Lifecycle of pointers to 'concrete' sub-objects (C#-binding patch included)

  • Olly Betts Olly Betts posted a comment on ticket #884

    It seems like the case which triggered this report was probably really due to incorrect code elsewhere. However it seems to me that when SWIG is checking if the object is null in such cases it would still be better for it do (object)obj == null (and similarly for some obj != null tests I see which the patch here doesn't address) as it really does want an exact null check and it isn't necessary to be calling an overloaded == in this case. Usually what SWIG currently does just incurs a small but avoidable...

  • Olly Betts Olly Betts modified ticket #884

    [csharp] getCPtr should use object.ReferenceEquals

  • Olly Betts Olly Betts modified ticket #884

    [csharp] getCPtr should use object.ReferenceEquals

  • Olly Betts Olly Betts modified ticket #1166

    [ruby] mixed case module names not handled correctly

  • Olly Betts Olly Betts posted a comment on ticket #1166

    https://github.com/rubocop/ruby-style-guide#snake-case-files adds evidence that what SWIG calls the "init name" ought to be lower case. According to that it perhaps ought to be open_babel here rather than openbabel for %module OpenBabel - SWIG does have CamelCase to snake_case conversion code so we could easily do that, and there's always -initname openbabel if that's what you really want. I think this should just apply to the auto-generated default, and an explicit -initname OpenBabel should allow...

  • Olly Betts Olly Betts posted a comment on ticket #1205

    I retested as there have been some using fixes recently and the cause of this looks to be using ClassC::MyFunc; in ClassD, but this is still reproducible with current git master (2e1506c1896f90456e5b3092ba7c7200c1b1e2e1): $ ../preinst-swig -c++ -java example.i $ grep -A3 'public double MyFunc(ClassX p)' ClassD.java public double MyFunc(ClassX p) { return exampleJNI.ClassD_MyFunc__SWIG_1(swigCPtr, this, ClassX.getCPtr(p), p); } public double MyFunc(ClassX p) { return exampleJNI.ClassD_MyFunc__SWIG_2(swigCPtr,...

  • Olly Betts Olly Betts posted a comment on ticket #1367

    Current git master (2e1506c1896f90456e5b3092ba7c7200c1b1e2e1) now emits two errors, but then still segfaults (with both the original and with = 0 removed to make it valid C++): ../preinst-swig -c++ -python test.i test.i:2: Warning 323: Recursive scope inheritance of 'A<(char,0)>'. test.i:2: Warning 323: Recursive scope inheritance of 'A< char,0 >'. Segmentation fault (core dumped) The crash is due to an infinite recursion, which this patch fixes: diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx...

  • Olly Betts Olly Betts modified ticket #1102

    [ruby] Segfault with "using" declaration with templates

  • Olly Betts Olly Betts posted a comment on ticket #1102

    This is fixed in current git master which generates code with Derived.fun in both chunks of code shown above. git bisect shows the commit fixing it as being: commit 49e60c7d5617f482026e8585d02ddc3f8244e2e5 Author: William S Fulton <wsf@fultondesigns.co.uk> Date: Sat Jun 24 11:43:15 2023 +0100 Fix directors and allprotected mode and using declarations. Fixes recently introduced seg fault, but this has never worked properly. Closes #2616 CHANGES.current | 5 ++++ Examples/test-suite/allprotected.i |...

  • William Fulton William Fulton modified ticket #932

    'using' directive may prevent constructor wrapping

  • William Fulton William Fulton posted a comment on ticket #932

    Fixed in 93732bb19562534c81c537b8a83e38451556415c for swig-4.2.0.

  • Olly Betts Olly Betts posted a comment on ticket #1317

    Great - 2ff9da0ce625eabf0dde3ffeaec075eba2c733a8 was the exact commit fixing this for the record.

  • William Fulton William Fulton modified ticket #1317

    template constructor of template class not recognized

  • William Fulton William Fulton posted a comment on ticket #1317

    Corrected testcase: %inline %{ template <typename T, typename U> struct MyClass { template<typename P> // MyClass<T,D>(P p) MyClass<T,U>(P p) { } }; %} %template(MyClassImpl) MyClass<int, int>; Note that MyClass<T,U> is not valid syntax from C++20 onwards, but SWIG continues to support it. The warning no longer appears in master, so this issue is fixed for swig-4.2.0.

  • William Fulton William Fulton modified a comment on ticket #932

    Your code above is invalid. However, if it is corrected: %inline %{ class Base { public: virtual void f(int n) = 0; void f(double another_representation_of_n) { } }; //And a derived class class Derived : public Base { public: Derived() {} using Base::f; virtual void f(int n) {} }; %} Then Derived does not have a constructor and this is incorrect. There is an easy workaround for now and that is to swap two lines around as such: virtual void f(int n) {} using Base::f;

  • William Fulton William Fulton modified ticket #678

    -copyctor bug?!

  • William Fulton William Fulton posted a comment on ticket #678

    This bug is a problem with non-const copy constructors in an inheritance chain. SWIG always assumed the implicit copy constructor was defined with a const reference parameter. For reference, https://en.cppreference.com/w/cpp/language/copy_constructor outlines nicely when the implicit constructor uses a const or non-const reference parameter. Fixed in 74e1deef6bd86135ee2a5f007b6347202813d143.

  • Olly Betts Olly Betts posted a comment on ticket #678

    Reproduced with 5e1a37c6c562b7cb62c62e439c5b6b647e6d6df5 (retested because that commit fixes a copyctor bug).

  • Olly Betts Olly Betts posted a comment on ticket #678

    Reproduced with 595009cf2ff952d963a663113e82b032c4fa770f.

  • Olly Betts Olly Betts posted a comment on ticket #1372

    I've opened a PR with that change: https://github.com/swig/swig/pull/2644

  • Olly Betts Olly Betts posted a comment on ticket #1359

    There have been some allprotected fixes recently, but this is still reproducible.

  • Olly Betts Olly Betts posted a comment on ticket #1160

    There have been some allprotected fixes recently, but this is still reproducible.

  • Andriy Gerasika Andriy Gerasika posted a comment on ticket #39

    I am interested in this feature -- can you please send the changes, so I can integrate these into most recent version of Swig on Github? Thank You

  • Olly Betts Olly Betts posted a comment on ticket #1250

    Looks like https://sourceforge.net/p/swig/bugs/879/ is closely related and probably the same issue.

  • Olly Betts Olly Betts posted a comment on ticket #879

    Still reproducible. Looks like https://sourceforge.net/p/swig/bugs/1250/ is closely related and probably the same issue.

  • Olly Betts Olly Betts posted a comment on ticket #1063

    I've opened a PR with this patch to try to move things forwards: https://github.com/swig/swig/pull/2636

  • Olly Betts Olly Betts posted a comment on ticket #780

    https://github.com/swig/swig/issues/1171 may be related.

  • Olly Betts Olly Betts modified ticket #983

    Wrapping Intel IPP headers generates assertion.

  • Olly Betts Olly Betts posted a comment on ticket #983

    I failed to fully revert my second attempt, and actually left the first fix in place, just without the testcase, so this really was fixed in SWIG 4.1.0 (and I've just confirmed that the original full example can be processed successfully with currently SWIG git master).

  • Olly Betts Olly Betts posted a comment on ticket #1163

    Fixed on git master by https://github.com/swig/swig/commit/26dfe3394810a72e85c4c52ee568ff44cfbcac76. Fix should be in 4.2.0. (https://github.com/swig/swig/issues/1881 seems to actually be slightly different as that's not fixed by this change)

  • Olly Betts Olly Betts modified ticket #1005

    %ignore not utilized for xml output

  • Olly Betts Olly Betts posted a comment on ticket #1005

    In https://github.com/swig/swig/issues/2213 @wsfulton said about -xml: XML isn't really a target language at all and it never will be! It's not much different to the -debug-top debug option which dumps internal parse tree information. The main difference is the format of the output. The Foo class appears in the output of swig -c++ -python -debug-top 1 Examples/test-suite/class_ignore.i (and similarly for -debug-top 2 to -debug-top 4) . So while -xml is essentially undocumented, I think this is working...

  • Olly Betts Olly Betts posted a comment on ticket #723

    It's a two dimension array of function pointers if I've understood it correctly, though I'm not certain I have. Actually, I think it's a two dimensional array of pointers to int. Still reproducible. Possibly related to https://github.com/swig/swig/issues/142

  • Olly Betts Olly Betts modified ticket #876

    SWIG tries to wrap va_list dumbly

  • Olly Betts Olly Betts posted a comment on ticket #876

    Reflecting on this, I think the now-documented approach mentioned above is a reasonable solution. Also APIs I've seen which have a function taking va_list often also provide a corresponding varargs function too, and in such cases attempting to automatically wrap the va_list one by generating a varargs function and wrapping it would be actively unhelpful. It'd be nicer to not generate wrapper code which doesn't compile for functions taking va_list, but I don't think we have a way to avoid wrapping...

  • Olly Betts Olly Betts posted a comment on ticket #1391

    Ticket moved from /p/swig/feature-requests/93/

  • Olly Betts Olly Betts posted a comment on ticket #1390

    Ticket moved from /p/swig/feature-requests/62/

  • William Fulton William Fulton modified ticket #1062

    Parse error on two parameter template template argument

  • William Fulton William Fulton posted a comment on ticket #1062

    Duplicate of https://github.com/swig/swig/issues/1603 which is now fixed

  • William Fulton William Fulton modified ticket #1217

    partial specialization not recognized

  • William Fulton William Fulton posted a comment on ticket #1217

    Duplicate of https://github.com/swig/swig/issues/1300 which is now fixed.

  • Olly Betts Olly Betts posted a comment on ticket #697

    I think this is probably essentially the same as https://github.com/swig/swig/issues/2089

  • Olly Betts Olly Betts modified a comment on ticket #1328

    (Though the testcase needs tweaking slightly to actually define the enum (e.g. enum TestEnum { TESTENUM };) or else compilation gives an error: test_wrap.cxx:3159:8: error: use of enum ‘TestEnum’ without previous declaration 3159 | enum TestEnum; | ^~~~~~~~ with that adjustment the generated wrapper fails to compile with: g++ `python3-config --cflags` -fPIC -c test_wrap.cxx -o test_wrap.o test_wrap.cxx: In function ‘PyObject* _wrap_new_VecTestNum(PyObject*, PyObject*)’: test_wrap.cxx:3327:38: error:...

  • Olly Betts Olly Betts posted a comment on ticket #1328

    (Though the testcase needs tweaking slightly to actually define the enum (e.g. enum TestEnum { TESTENUM };) or else compilation gives an error: test_wrap.cxx:3159:8: error: use of enum ‘TestEnum’ without previous declaration 3159 | enum TestEnum; | ^~~~~~~~ with that adjustment the generated wrapper fails to compile with: g++ `python3-config --cflags` -fPIC -c test_wrap.cxx -o test_wrap.o test_wrap.cxx: In function ‘PyObject* _wrap_new_VecTestNum(PyObject*, PyObject*)’: test_wrap.cxx:3327:38: error:...

  • Olly Betts Olly Betts posted a comment on ticket #1328

    Still reproduces with current git master (b18b75369cd4b2795abad1283629b13a62630b58)

1 >