swig win32 scons

M

myheartinamerica

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])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top