I would like to create a python C extension using XCode 4.5.2 so that I can use the xcode debugger. The extensions require the C file to be linked as a .so file. I have not been able to make .so file in xcode, only dylib files.

I tried as follows: 1. Used the C/C++ Library template, specified dynamic library 2. Change the Mach-O type to Bundle 3. Still could not make an .so so I changed the wrapper extension to .so, with no luck.

The post link below seems to say that I can just manually change the extension. This did not work for me, but I could have made another mistake.

how to make python load dylib on osx

Any thoughts on my problem?

有帮助吗?

解决方案

.so files serve the same purpose on Linux (and some other Unixes) that .dylib files on OS X - they're dynamically linked libraries. If everything else fails, and Python cannot recognize your platform (and the fact that on OS X, it should look for .dylib files instead), make a symbolic link from the .dylib file with the same name but with the extension .so.

(Yes, this is a quite ugly hack, but it's simple, straightforward and it works.)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top