471,123 Members | 945 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

swig win32 scons

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
1 2962
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.

Similar topics

reply views Thread by Phil Schmidt | last post: by
8 posts views Thread by ted | last post: by
3 posts views Thread by corey.coughlin | last post: by
reply views Thread by ReaprZero | last post: by
reply views Thread by gamename | last post: by
1 post views Thread by anush | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.