Skip to content

Instantly share code, notes, and snippets.

@robertwb
Created August 16, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertwb/5b6084487ad8392ddee00cf1a85586c8 to your computer and use it in GitHub Desktop.
Save robertwb/5b6084487ad8392ddee00cf1a85586c8 to your computer and use it in GitHub Desktop.
Attachment windows.jek.patch for http://trac.cython.org/ticket/12
# HG changeset patch
# User jek-cythonhg@kleckner.net
# Date 1217006267 25200
# Node ID 92f760be4cfc8c8714056edf26953dc975836086
# Parent f1cc08ccb0b3adc9247147ba26f8dd7393995cd4
Small patch for WINDOWS for __cdecl and _USE_MATH_DEFINES
On the WINDOWS platform __cdecl must not be removed.
Also added define of _USE_MATH_DEFINES to make
M_PI and the lot get defined as with the standard math.h.
diff -r f1cc08ccb0b3 -r 92f760be4cfc Cython/Compiler/ModuleNode.py
--- a/Cython/Compiler/ModuleNode.py Wed Jul 23 23:02:37 2008 -0700
+++ b/Cython/Compiler/ModuleNode.py Fri Jul 25 10:17:47 2008 -0700
@@ -481,11 +481,15 @@
code.putln(" #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)")
code.putln("#endif")
- code.putln("#ifndef __stdcall")
+ code.putln("#ifndef MS_WINDOWS")
+ code.putln(" #ifndef __stdcall")
code.putln(" #define __stdcall")
- code.putln("#endif")
- code.putln("#ifndef __cdecl")
+ code.putln(" #endif")
+ code.putln(" #ifndef __cdecl")
code.putln(" #define __cdecl")
+ code.putln(" #endif")
+ code.putln("#else")
+ code.putln(" #define _USE_MATH_DEFINES")
code.putln("#endif")
self.generate_extern_c_macro_definition(code)
code.putln("#include <math.h>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment