By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,302 Members | 3,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,302 IT Pros & Developers. It's quick & easy.

swig win32 scons

P: n/a
Hello,

I spent the morning figuring out how to use SWIG on Microsoft Windows.
I compiled the example from the SWIG tutorial on http://www.swig.org.
The biggest stumbling block was not knowing that I needed to rename
the DLL created to have a PYD extension. I also ended up writing
a .def file for exporting functions from the DLL.

Here is my SConstruct file for using SCons to build the library. It is
not perfect, but it should be evident as to what I was doing. I hope
that others will be able to find this in the future and save
themselves some time.:
##############################
SWIG_EXE = r'C:\Python25\swig\swig.exe'
env = Environment(SWIG=SWIG_EXE,
SWIGFLAGS=['-python'],
CPPPATH=[r'C:\Python25\include'],
LIBPATH=[r'C:\Python25\libs'])
swigObject = env.SharedObject(['example.i'])
copyToPYD = Copy('_example.pyd', '_example.dll')
env.AddPostAction('_example.dll', copyToPYD)
env.SharedLibrary('_example.dll', ['example.c', swigObject])

Apr 16 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
It turns out I didn't need the DEF file for exports.

Apr 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.