Build: avoid win32-incompatible functions #2019

Merged
merged 1 commit into from May 17, 2013

2 participants

@GBillotey

Dating from commit e1e0848, I have been experimenting compiling errors (under win32).

c:\users\geoffroy\documents\github\matplotlib\src\path_converters.h(895) : error C3861: 'seed48': identifier not found
        c:\users\geoffroy\documents\github\matplotlib\src\path_converters.h(893) : while compiling class template member function 'void Sketch<VertexSource>::rewind(unsigned int)'
        with
        [
            VertexSource=curve_t
        ]
        src/_path.cpp(1516) : see reference to class template instantiation 'Sketch<VertexSource>' being compiled
        with
        [
            VertexSource=curve_t
        ]

They seem to be linked with the use of traditional UNIX functions like drand48 in path_converters.h. seed48 and M_PI are also problematic.

Enclosed is a patch attempt which uses ANSI C function rand and srand instead, and at least compile correctly - with win SDK. (The code being quite complex I can't be sure with my limited C++ knowledge this is the best way to deal with it ; hope it can help though)

@mdboom
Matplotlib Developers member

Indeed. I should have been more careful about sticking to ANSI C. Thanks for the PR.

@mdboom mdboom merged commit f311ef5 into matplotlib:master May 17, 2013

1 check passed

Details default The Travis CI build passed
@GBillotey GBillotey deleted the GBillotey:SDK_build branch May 18, 2013
@GBillotey

Thanks for the merge.

While having a last read:
shouldn't I have used doubles instead of floats for _drand and _M_PI ? If you confirm, I would be happy to do the short corrective PR (sorry, I should have paid more attention in the first place).

@mdboom
Matplotlib Developers member

Indeed. Thanks for catching that. Practically speaking, I don't think it much matters on images of reasonably normal size. However, we should probably be consistent with doubles everywhere (since that's what's used for vertices in general).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment