Recently in Perl 5 Category

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 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 = {
  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.


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.

About this Archive

This page is an archive of recent entries in the Perl 5 category.

Perlcast is the next category.

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