1
# cython: c_string_type=str
2
# cython: c_string_encoding=ascii
12
>>> log(10) # doctest: +ELLIPSIS
13
Traceback (most recent call last):
14
NameError: ...name 'log' is not defined
16
>>> my_strchr('abcabc', ord('c'))
18
>>> my_strchr(needle=ord('c'), haystack='abcabc')
21
>>> strchr('abcabc', ord('c'))
23
>>> strchr(needle=ord('c'), haystack='abcabc')
27
cdef extern from "math.h":
28
cpdef double sqrt(double)
29
cpdef double pyx_sqrt "sqrt"(double)
30
cdef double log(double) # not wrapped
32
cdef extern from "string.h":
34
/* The return type of strchr differs between C and C++.
35
This test is not interested in that, so create a wrapper function
36
with a known return type.
38
static const char* my_strchr(const char *haystack, int needle) {
39
return strchr(haystack, needle);
42
cpdef const char* my_strchr(const char *haystack, int needle)
43
cpdef const char* strchr "my_strchr" (const char *haystack, int needle)