[Numpy-discussion] Compile extension modules with Visual Studio 2005

Robert Kern robert.kern@gmail....
Tue Jul 24 14:32:10 CDT 2007


Geoffrey Zhu wrote:
> Hi Robert,
> 
> On 7/24/07, Robert Kern <robert.kern@gmail.com> wrote:
>> Geoffrey Zhu wrote:
>>> Thanks for your help. Do you know what exactly is the issue of having
>>> to use VS2003 to build extensions? If the interactions are done at DLL
>>> level, shouldn't call compilers that can generate DLLs work?
>> Mostly it's an issue of the C runtime that is used for either compiler. C
>> extensions need to use the same runtime as Python itself. Mostly.
> 
> If it is a problem of the runtime library conflict, I can probably
> statically link the VS2005 runtime into my extension DLL and there
> would be no conflict. Do you see any problems with this plan? :-)

If it works, then no, no problem. distutils may balk at building your extension,
though.

>>> It doesn't look like using ctypes would be an option, as my goal is to
>>> 'vectorize' some operations.
>> You mean you need to use PyMultiIter objects for broadcasting? Yeah, that would
>> require an extension.
> 
> I haven't looked at PyMultilter objects. I am just trying to build a
> 'vector version' of my C function so that it can do batch
> calculations. For example, for a vector X, I can do
> 
> for x in X: y=my_func(x)
> 
> Or I can do Y=my_vector_func(X).
> 
> The latter is probably much more efficient. That's why I need the extension.

ctypes would be an option, then. You would just do the loop in C.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list