← Back to team overview

kicad-developers team mailing list archive

Re: Python scripting build broken on windows.


On 12/12/2018 2:27 AM, jp charras wrote:
> Le 11/12/2018 à 20:38, Maciej Suminski a écrit :
>> Hi Wayne, Seth,
>> On 12/11/18 7:51 PM, Wayne Stambaugh wrote:
>> [...]
>>> FYI, swig does not support unique_ptr or weak_ptr yet[1].  If you change
>>> any code in pcbnew that gets swigged using these pointer templates, the
>>> python scripting will fail to build.  If you want to use unique_ptr, you
>>> will have to create a swig wrapper for it[2].  SWIG does support
>>> shared_ptr so that may be an option.
>> Sorry for the build errors and thanks for the quick reaction. I have
>> seen unique_ptrs all over the KiCad code, so it has never occurred to me
>> that they need a special treatment for SWIG. I will find another
>> scripting-friendly way to fix the memory leaks.
>> Cheers,
>> Orson
> Hi Orson,
> The issue is due to this method:
> std::unique_ptr<wxConfigBase> GetNewConfig( const wxString& aProgName )
> that cannot be mapped by SWIG, because it returns a unique_ptr.
> This method is not really useful for python scripting.
> So the easy way is just to do not map it in pcbnew.py
> The attached basic patch show hos to do that.
> (There are many other examples in Kicad code that use this trick)

I think you can also use "%ignore GetNewConfig;" in the appropriate swig
file.  The documentation for %ignore can be found here
http://swig.org/Doc3.0/SWIG.html#SWIG_rename_ignore.  I would prefer
this method if possible to keep our headers clean from as many
#ifdef/#endif blocks as possible.