Ruben, thanks for your feedback.

Yes, my example is intentionally kept minimal and simple to serve as a proof of concept.

As you see below, there are more complex integrations with Python/SWIG (RAPI, for instance), that also suffer from this problem:

https://github.com/ilveroluca/rapi

They both compile and not segfault in Linux but crash in OSX, independently of their complexity.


On Mon, Aug 18, 2014 at 7:12 PM, Ruben De Smet <ruben.de.smet@telenet.be> wrote:
On 08/18/2014 06:49 PM, brainstorm wrote:
> Sorry for the cross-posting, but I wonder if any of you have a good
> solution for this problem I'm experiencing with SWIG and Python on OSX:
>
> http://stackoverflow.com/questions/25349828/barebones-swig-python-c-interface-segfaulting-on-osxclang-not-in-linuxgcc
>
> Thanks in advance!
> Roman
>
>

As I don't have enough reputation to comment (I can only answer), I'll
answer by email.
First of all, I see your interface file is empty, except for the %module
directive. That shouldn't generate segfault AFAIK, but I'd put something
in there.
Second, I hope you'll be entering some body for the main in the .c file.
If Python is stupid enough to start running code in main(); - which it
probably isn't, but you never know - it'll segfault indeed.

So, put something in that interface file, add it to the .c file and post
again :)

Ruben