私はCythonを学ぶためにCythonのチュートリアルのいくつかの例を再現してみてください。Cythonでこの警告が表示されるのはなぜですか?
http://docs.cython.org/en/latest/src/tutorial/external.html
私は2つの次の警告は、関連はないと思います。したがって、2 qestions:
(1)
のpython setup.pyにbuild_ext --inplace -C MINGW32
from libc.math cimport sin
cdef extern from "math.h":
cdef double sin(double x)
cpdef double f(double x):
return sin(x*x)
cpdef test(double x):
return f(x)
への入力としてこれを使用して私が取得:
をD:\python\cython>python setup.py build_ext --inplace -c mingw32
Compiling primes.pyx because it changed.
[1/1] Cythonizing primes.pyx
warning: primes.pyx:4:19: Function signature does not match previous declaration
running build_ext
building 'primes' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python34\include -IC:\Python34\include -c primes.c -o build\temp.win32-3.4\Release\primes.o
writing build\temp.win32-3.4\Release\primes.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-3.4\Release\primes.o build\temp.win32-3.4\Release\primes.def -LC:\Python34\libs -LC:\Python34\PCbuild -lpython34 -lmsvcr100 -o D:\python\cython\primes.pyd
D:\python\cython>
「関数シグネチャが前の宣言と一致しません」という警告が表示されるのはなぜですか?
(2)私は
cdef extern from "math.h":
cpdef double sin(double x)
は私が
warning: primes.pyx:4:20: Function 'sin' previously declared as 'cpdef'
しかし、それは章「外部での例と同じように正確に与えられている追加の警告を受ける宣言
リンク先のページの "宣言"モジュールがインポートされるPythonモジュールでは、パッケージの下でsinが知られていません。問題はどこだ?
チュートリアルの説明である:チュートリアルの
Note that you can easily export an external C function from your Cython module by declaring it as cpdef. This generates a Python wrapper for it and adds it to the module dict.
_「次の2つの警告は関連していないと思いますので、2つの疑問があります:「_質問1つで質問してください –