Skip to content

vector.data() not supported on MS VC++ 9.0 #200

@anthrotype

Description

@anthrotype

std::vector::data is defined in C+11, so Microsoft Visual C++ 9.0 (aka Visual Studio 2008) does not support it and raises the following error:

python/brotlimodule.cc(194) : error C2039: 'data' : is not a member of 'std::vector<_Ty>'
        with
        [
            _Ty=uint8_t
        ]

The (uglier) method &vector[0] could be used instead of vector.data() to get the pointer to the underlying array (provided it isn't empty).

As you know, Python 2.7 for Windows is still compiled with Visual Studio 2008, so all extension modules should in theory be compiled using the same MSVC compiler version. After VS2008 was discontinued, Microsoft released an ad-hoc "Visual C++ Compiler for Python 2.7" (http://aka.ms/vcpython27) meant to be used for compiling extension for Windows Python 2.7.

In the current Brotli's setup.py, I added a patch to force distutils use Visual Studio 2010 for Python 2.7. This seems to work well so far, despite many people warn against mixing different C runtimes versions between the interpreter and the extension modules.

Since you recently added support for C++98, it'd be nice to also try support the old Microsoft compiler.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions