SWIG Python Extension winth C++ Problematic

Chandrashekhar kaushik shekhar.kaushik at gmail.com
Fri Aug 4 00:29:23 EDT 2006


someone ??

On 8/4/06, Chandrashekhar kaushik <shekhar.kaushik at gmail.com> wrote:
>
> Hi
> I have been working getting my C++ code to be used in Python ( Basically
> Extending )
> This is the problem i am facing rite now.
>
> I have a function that returns a Pointer to a class in my C++ Code
>
> It looks like this
>
> SLSocket* SLSocket::accept( SLHostInfo& client ){
>     socklen_t    addrlen = sizeof( struct sockaddr_in );
>     int new_fd = ::accept( sock_fd , ( struct sockaddr* )client.address()
> , &addrlen );
>     if( new_fd == -1 ){
>         sl_set_error(string("SLSocket::accept() : ") + string(
> sys_errlist[ errno ] ));
>         return NULL;
>      }else{
>         return new SLSocket( new_fd );
>      }
> }
>
> I have used SWIG to get the Glue code.
>
> When i call this function ( in python ) and it eventually returns ( when
> it gets a connection in this case )
> it crashes ! I get a SEG FAULT !
>
> Is it some thing that cannot be done ?
> Are C++ functions those return pointers a pain in Python
>
> Help :D
>
>
> --
> shekhar
>



-- 
--
shekhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060804/23a6cb4c/attachment.html>


More information about the Python-list mailing list