[MATRIX-SIG] compiling NumPy for Windows

Perry Stoll pas@xis.xerox.com
Thu, 29 Jan 1998 11:26:28 PST


Looking at the symbols that are missing, I'd guess you're not linking
against
numpy.lib, which can be accomplised by including ("Add to Project")
numpy.lib in the project when building (I'm using VC++ 5.0, so I hope that
translates to VC++ 4.2...)


I went through something similar last night to get Konrad's RNG working on
WinNT. Which it does, I'm happy to report. Although only after some tweaking
to build as a dynamic extension dll - does anyone know why when building a
dll extension, the following:

static PyTypeObject distributiontype = {
  PyObject_HEAD_INIT(&PyType_Type)
    0,    /*ob_size*/
    "random_distribution", /*tp_name*/

Gives an error: Initialization from non-const value (refering to
&PyType_Type).
Changing it to:

static PyTypeObject distributiontype = {
  PyObject_HEAD_INIT(NULL)
    0,    /*ob_size*/
    "random_distribution", /*tp_name*/

And then doing the following in initRNG:

    distributiontype.ob_type = &PyType_Type;

fixes the problem and lets the module function correctly.

(I learned that trick from Fredrick's tk extension for Win32). That seems
awfully nasty - am I doing something wrong? I'm guessing that the judicious
use of USE_DL_EXPORT or USE_DL_IMPORT might get rid of the problem...

Building extensions on the PC is not painless, but it's doable.

-Perry Stoll
 pas@xis.xerox.com

-----Original Message-----
From: Andrey Kaliazin <KaliazinA@cardiff.ac.uk>
To: matrix-sig@python.org <matrix-sig@python.org>
Date: Thursday, January 29, 1998 1:37 PM
Subject: [MATRIX-SIG] compiling NumPy for Windows



I have included manually netcdfmodule in project and two strings in
config.c to init netCDF, NumPy's "arrayobject.h" is also on path.

But linker fails.
--------------------------------------------------
Visual C++ 4.2 compiler say:
...
Creating library vc40/python15.lib and object vc40/python15.exp
netcdfmodule.obj : error LNK2001: unresolved external symbol
_PyArray_Return
netcdfmodule.obj : error LNK2001: unresolved external symbol
_PyArray_FromDims
netcdfmodule.obj : error LNK2001: unresolved external symbol
_PyArray_ContiguousFromObject
vc40/python15.dll :   fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
----------------------------------------------------
Can anybody give me idea, what's going on?

Sincerely,




_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________