![](https://secure.gravatar.com/avatar/e3a4852940b55f9ec9ef48d9a4b65b4e.jpg?s=120&d=mm&r=g)
(Sidenote: I also needed a swig-object in build_ext for my setup-script for win32all. I had to extend distutils in the setup-script because there are also exe-files to be built from C++ and swig sources). but this is of course nonsense. Swig is used to build
I wrote: python-extensions, not exe-files. Sorry for that. Greg:
I thought I mentioned this recently: there *is* a 'link_executable()' method in MSVCCompiler. If it works, why not use it? If it doesn't work, could you submit a patch instead of implementing your own? (And if the interface specified by CCompiler is insufficient, I'd like to find out *now*!) Yes, I used compile() and link_shared_object() in my win32 setup script. No need to worry about it.
As I pointed out in a separate post, there should also be an option to specify C or C++ processing.
Agreed -- yet another good argument for a SWIG class.
If I find time, I will submit a new patch.
Cool. My time is probably better spent learning SWIG. No wait, I mean documenting and testing the Distutils... sigh...
Well, actually I also don't use swig normally. I was forced to use it for Marks win32 stuff. He lets swig generate c++ code, so... Appended is a patch for your swig patches (;-) which adds an --swig-cpp command line option to build_ext, so that I can build the win32 stuff again. There should probably better be an option for the Extension() class, but (hopefully) someone else can do this. This is in chunks 1, 2, 4, 5. Chunks 3 and 6 contain a change for building extensions on NT: MSVC generates .lib and .exp files when building shared libraries. The .exp files are usually unneeded, the .lib files are import libraries, which may be needed for (other) dlls linking to the first one. Up to now these files were created in the build/lib.win32/Release or build/lib.win32/Debug directories. Sometimes python extensions are dependend on each other. One example is the ODBC stuff included in Marks code: The odbc extension links dynamically to the dbi extension. So I changed build_ext to create the .lib (and .exp) files in the build/lib.win32 directory. Since they have different names for debug and release builds, no conficts occur: dbi.lib, dbi_d.lib. Thomas