Subhasis Ray | 13 Dec 08:45 2011
Picon

fpermissive issue with swig generated wrapper and gcc 4.6

Hi,
  I have been using swig to wrap a C++ library into a Python module. It used to work fine with older versions of gcc but after switching to gcc 4.6, I am getting this:
"error: taking address of temporary [-fpermissive]"
  By looking at the wrapper file, I found that this happens to attributes of type string or vector or other STL types [they are specified via getter function returning string, etc].
I tried using -naturalvar flag with swig, but that did not help. If I use -fpermissive with g++, the generated module causes segmentation fault (at load time for a debug build, at runtime for a build without the debug symbols).
I suspect most people wrapping c++ have functions that return a local string or vector but I could not find any recommended workaround on the Internet.
Any suggestions?

Thanks,
  Subha

------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
William S Fulton | 15 Dec 08:12 2011
Picon

Re: fpermissive issue with swig generated wrapper and gcc 4.6

On 13/12/11 07:45, Subhasis Ray wrote:
> Hi,
>    I have been using swig to wrap a C++ library into a Python module. It
> used to work fine with older versions of gcc but after switching to gcc
> 4.6, I am getting this:
> "error: taking address of temporary [-fpermissive]"
>    By looking at the wrapper file, I found that this happens to
> attributes of type string or vector or other STL types [they are
> specified via getter function returning string, etc].
> I tried using -naturalvar flag with swig, but that did not help. If I
> use -fpermissive with g++, the generated module causes segmentation
> fault (at load time for a debug build, at runtime for a build without
> the debug symbols).
> I suspect most people wrapping c++ have functions that return a local
> string or vector but I could not find any recommended workaround on the
> Internet.
> Any suggestions?

I have run the SWIG test-suite using gcc-4.6 in the past and don't 
recall any problems. Can you please provide a small cutdown example 
showing this problem. Include versions of everything and all compiler flags.

William

------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/

Gmane