Compiling Inline::Python 0.22 on Win32

| No TrackBacks

I recently tried to compile Inline::Python 0.22 on Win32 with Visual C++ 7.1. I started with the usual build mantra.

perl Makefile.PL
nmake
nmake test
nmake install

But I only got up to "nmake," and got hit by the following compiler error.

perlmodule.c(160) : error C2099: initializer is not a constant

By the way, it's the very same thing with Visual C++ 8.0, also known as Visual C++ 2005.

The problem comes from the following code snippet.

DL_EXPORT(PyTypeObject) PerlPkg_type = {
  PyObject_HEAD_INIT(&PyType_Type)
  0,                            /*ob_size*/
...
};

The offending part is "PyObject_HEAD_INIT(&PyType_Type)" because it is not strictly conforming C, as explained in the Python documentation. The solution is also explained there: Replace the construct with the following one.

PyObject_HEAD_INIT(NULL)

There are two more places with the same construct, which I had to replace too. Another "nmake," and the module was compiled. The test were passing too.

>nmake test
All tests successful, 58 subtests skipped.

No TrackBacks

TrackBack URL: http://www.rblasch.org/cgi-bin/mt/mt-tb.cgi/3

About this Entry

This page contains a single entry by Ron published on December 14, 2005 11:45 PM.

First Perlcast Interview Transcript Available was the previous entry in this blog.

Started Transcript of Perlcast's Interview with Randal Schwartz is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.