~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Modules/_ctypes/_ctypes_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <Python.h>
 
2
 
 
3
#ifdef MS_WIN32
 
4
#include <windows.h>
 
5
#endif
 
6
 
 
7
#if defined(MS_WIN32) || defined(__CYGWIN__)
 
8
#define EXPORT(x) __declspec(dllexport) x
 
9
#else
 
10
#define EXPORT(x) x
 
11
#endif
 
12
 
 
13
/* some functions handy for testing */
 
14
 
 
15
EXPORT(void)testfunc_array(int values[4])
 
16
{
 
17
        printf("testfunc_array %d %d %d %d\n",
 
18
               values[0],
 
19
               values[1],
 
20
               values[2],
 
21
               values[3]);
 
22
}
 
23
 
 
24
EXPORT(long double)testfunc_Ddd(double a, double b)
 
25
{
 
26
        long double result = (long double)(a * b);
 
27
        printf("testfunc_Ddd(%p, %p)\n", &a, &b);
 
28
        printf("testfunc_Ddd(%g, %g)\n", a, b);
 
29
        return result;
 
30
}
 
31
 
 
32
EXPORT(long double)testfunc_DDD(long double a, long double b)
 
33
{
 
34
        long double result = a * b;
 
35
        printf("testfunc_DDD(%p, %p)\n", &a, &b);
 
36
        printf("testfunc_DDD(%Lg, %Lg)\n", a, b);
 
37
        return result;
 
38
}
 
39
 
 
40
EXPORT(int)testfunc_iii(int a, int b)
 
41
{
 
42
        int result = a * b;
 
43
        printf("testfunc_iii(%p, %p)\n", &a, &b);
 
44
        return result;
 
45
}
 
46
 
 
47
EXPORT(int)myprintf(char *fmt, ...)
 
48
{
 
49
        int result;
 
50
        va_list argptr;
 
51
        va_start(argptr, fmt);
 
52
        result = vprintf(fmt, argptr);
 
53
        va_end(argptr);
 
54
        return result;
 
55
}
 
56
 
 
57
EXPORT(char *)my_strtok(char *token, const char *delim)
 
58
{
 
59
        return strtok(token, delim);
 
60
}
 
61
 
 
62
EXPORT(char *)my_strchr(const char *s, int c)
 
63
{
 
64
        return strchr(s, c);
 
65
}
 
66
 
 
67
 
 
68
EXPORT(double) my_sqrt(double a)
 
69
{
 
70
        return sqrt(a);
 
71
}
 
72
 
 
73
EXPORT(void) my_qsort(void *base, size_t num, size_t width, int(*compare)(const void*, const void*))
 
74
{
 
75
        qsort(base, num, width, compare);
 
76
}
 
77
 
 
78
EXPORT(int *) _testfunc_ai8(int a[8])
 
79
{
 
80
        return a;
 
81
}
 
82
 
 
83
EXPORT(void) _testfunc_v(int a, int b, int *presult)
 
84
{
 
85
        *presult = a + b;
 
86
}
 
87
 
 
88
EXPORT(int) _testfunc_i_bhilfd(signed char b, short h, int i, long l, float f, double d)
 
89
{
 
90
/*      printf("_testfunc_i_bhilfd got %d %d %d %ld %f %f\n",
 
91
               b, h, i, l, f, d);
 
92
*/
 
93
        return (int)(b + h + i + l + f + d);
 
94
}
 
95
 
 
96
EXPORT(float) _testfunc_f_bhilfd(signed char b, short h, int i, long l, float f, double d)
 
97
{
 
98
/*      printf("_testfunc_f_bhilfd got %d %d %d %ld %f %f\n",
 
99
               b, h, i, l, f, d);
 
100
*/
 
101
        return (float)(b + h + i + l + f + d);
 
102
}
 
103
 
 
104
EXPORT(double) _testfunc_d_bhilfd(signed char b, short h, int i, long l, float f, double d)
 
105
{
 
106
/*      printf("_testfunc_d_bhilfd got %d %d %d %ld %f %f\n",
 
107
               b, h, i, l, f, d);
 
108
*/
 
109
        return (double)(b + h + i + l + f + d);
 
110
}
 
111
 
 
112
EXPORT(long double) _testfunc_D_bhilfD(signed char b, short h, int i, long l, float f, long double d)
 
113
{
 
114
/*      printf("_testfunc_d_bhilfd got %d %d %d %ld %f %f\n",
 
115
               b, h, i, l, f, d);
 
116
*/
 
117
        return (long double)(b + h + i + l + f + d);
 
118
}
 
119
 
 
120
EXPORT(char *) _testfunc_p_p(void *s)
 
121
{
 
122
        return (char *)s;
 
123
}
 
124
 
 
125
EXPORT(void *) _testfunc_c_p_p(int *argcp, char **argv)
 
126
{
 
127
        return argv[(*argcp)-1];
 
128
}
 
129
 
 
130
EXPORT(void *) get_strchr(void)
 
131
{
 
132
        return (void *)strchr;
 
133
}
 
134
 
 
135
EXPORT(char *) my_strdup(char *src)
 
136
{
 
137
        char *dst = (char *)malloc(strlen(src)+1);
 
138
        if (!dst)
 
139
                return NULL;
 
140
        strcpy(dst, src);
 
141
        return dst;
 
142
}
 
143
 
 
144
EXPORT(void)my_free(void *ptr)
 
145
{
 
146
        free(ptr);
 
147
}
 
148
 
 
149
#ifdef HAVE_WCHAR_H
 
150
EXPORT(wchar_t *) my_wcsdup(wchar_t *src)
 
151
{
 
152
        size_t len = wcslen(src);
 
153
        wchar_t *ptr = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
 
154
        if (ptr == NULL)
 
155
                return NULL;
 
156
        memcpy(ptr, src, (len+1) * sizeof(wchar_t));
 
157
        return ptr;
 
158
}
 
159
 
 
160
EXPORT(size_t) my_wcslen(wchar_t *src)
 
161
{
 
162
        return wcslen(src);
 
163
}
 
164
#endif
 
165
 
 
166
#ifndef MS_WIN32
 
167
# ifndef __stdcall
 
168
#  define __stdcall /* */
 
169
# endif
 
170
#endif
 
171
 
 
172
typedef struct {
 
173
        int (*c)(int, int);
 
174
        int (__stdcall *s)(int, int);
 
175
} FUNCS;
 
176
 
 
177
EXPORT(int) _testfunc_callfuncp(FUNCS *fp)
 
178
{
 
179
        fp->c(1, 2);
 
180
        fp->s(3, 4);
 
181
        return 0;
 
182
}
 
183
 
 
184
EXPORT(int) _testfunc_deref_pointer(int *pi)
 
185
{
 
186
        return *pi;
 
187
}
 
188
 
 
189
#ifdef MS_WIN32
 
190
EXPORT(int) _testfunc_piunk(IUnknown FAR *piunk)
 
191
{
 
192
        piunk->lpVtbl->AddRef(piunk);
 
193
        return piunk->lpVtbl->Release(piunk);
 
194
}
 
195
#endif
 
196
 
 
197
EXPORT(int) _testfunc_callback_with_pointer(int (*func)(int *))
 
198
{
 
199
        int table[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 
200
 
 
201
        return (*func)(table);
 
202
}
 
203
 
 
204
#ifdef HAVE_LONG_LONG
 
205
EXPORT(PY_LONG_LONG) _testfunc_q_bhilfdq(signed char b, short h, int i, long l, float f,
 
206
                                     double d, PY_LONG_LONG q)
 
207
{
 
208
        return (PY_LONG_LONG)(b + h + i + l + f + d + q);
 
209
}
 
210
 
 
211
EXPORT(PY_LONG_LONG) _testfunc_q_bhilfd(signed char b, short h, int i, long l, float f, double d)
 
212
{
 
213
        return (PY_LONG_LONG)(b + h + i + l + f + d);
 
214
}
 
215
 
 
216
EXPORT(int) _testfunc_callback_i_if(int value, int (*func)(int))
 
217
{
 
218
        int sum = 0;
 
219
        while (value != 0) {
 
220
                sum += func(value);
 
221
                value /= 2;
 
222
        }
 
223
        return sum;
 
224
}
 
225
 
 
226
EXPORT(PY_LONG_LONG) _testfunc_callback_q_qf(PY_LONG_LONG value,
 
227
                                             PY_LONG_LONG (*func)(PY_LONG_LONG))
 
228
{
 
229
        PY_LONG_LONG sum = 0;
 
230
 
 
231
        while (value != 0) {
 
232
                sum += func(value);
 
233
                value /= 2;
 
234
        }
 
235
        return sum;
 
236
}
 
237
 
 
238
#endif
 
239
 
 
240
typedef struct {
 
241
        char *name;
 
242
        char *value;
 
243
} SPAM;
 
244
 
 
245
typedef struct {
 
246
        char *name;
 
247
        int num_spams;
 
248
        SPAM *spams;
 
249
} EGG;
 
250
 
 
251
SPAM my_spams[2] = {
 
252
        { "name1", "value1" },
 
253
        { "name2", "value2" },
 
254
};
 
255
 
 
256
EGG my_eggs[1] = {
 
257
        { "first egg", 1, my_spams }
 
258
};
 
259
 
 
260
EXPORT(int) getSPAMANDEGGS(EGG **eggs)
 
261
{
 
262
        *eggs = my_eggs;
 
263
        return 1;
 
264
}
 
265
 
 
266
typedef struct tagpoint {
 
267
        int x;
 
268
        int y;
 
269
} point;
 
270
 
 
271
EXPORT(int) _testfunc_byval(point in, point *pout)
 
272
{
 
273
        if (pout) {
 
274
                pout->x = in.x;
 
275
                pout->y = in.y;
 
276
        }
 
277
        return in.x + in.y;
 
278
}
 
279
 
 
280
EXPORT (int) an_integer = 42;
 
281
 
 
282
EXPORT(int) get_an_integer(void)
 
283
{
 
284
        return an_integer;
 
285
}
 
286
 
 
287
EXPORT(double)
 
288
integrate(double a, double b, double (*f)(double), long nstep)
 
289
{
 
290
        double x, sum=0.0, dx=(b-a)/(double)nstep;
 
291
        for(x=a+0.5*dx; (b-x)*(x-a)>0.0; x+=dx)
 
292
                sum += f(x);
 
293
        return sum/(double)nstep;
 
294
}
 
295
 
 
296
typedef struct {
 
297
        void (*initialize)(void *(*)(int), void(*)(void *));
 
298
} xxx_library;
 
299
 
 
300
static void _xxx_init(void *(*Xalloc)(int), void (*Xfree)(void *))
 
301
{
 
302
        void *ptr;
 
303
        
 
304
        printf("_xxx_init got %p %p\n", Xalloc, Xfree);
 
305
        printf("calling\n");
 
306
        ptr = Xalloc(32);
 
307
        Xfree(ptr);
 
308
        printf("calls done, ptr was %p\n", ptr);
 
309
}
 
310
 
 
311
xxx_library _xxx_lib = {
 
312
        _xxx_init
 
313
};
 
314
 
 
315
EXPORT(xxx_library) *library_get(void)
 
316
{
 
317
        return &_xxx_lib;
 
318
}
 
319
 
 
320
#ifdef MS_WIN32
 
321
/* See Don Box (german), pp 79ff. */
 
322
EXPORT(void) GetString(BSTR *pbstr)
 
323
{
 
324
        *pbstr = SysAllocString(L"Goodbye!");
 
325
}
 
326
#endif
 
327
 
 
328
/*
 
329
 * Some do-nothing functions, for speed tests
 
330
 */
 
331
PyObject *py_func_si(PyObject *self, PyObject *args)
 
332
{
 
333
        char *name;
 
334
        int i;
 
335
        if (!PyArg_ParseTuple(args, "si", &name, &i))
 
336
                return NULL;
 
337
        Py_INCREF(Py_None);
 
338
        return Py_None;
 
339
}
 
340
 
 
341
EXPORT(void) _py_func_si(char *s, int i)
 
342
{
 
343
}
 
344
 
 
345
PyObject *py_func(PyObject *self, PyObject *args)
 
346
{
 
347
        Py_INCREF(Py_None);
 
348
        return Py_None;
 
349
}
 
350
 
 
351
EXPORT(void) _py_func(void)
 
352
{
 
353
}
 
354
 
 
355
EXPORT(PY_LONG_LONG) last_tf_arg_s;
 
356
EXPORT(unsigned PY_LONG_LONG) last_tf_arg_u;
 
357
 
 
358
struct BITS {
 
359
        int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9;
 
360
        short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7;
 
361
};
 
362
 
 
363
EXPORT(void) set_bitfields(struct BITS *bits, char name, int value)
 
364
{
 
365
        switch (name) {
 
366
        case 'A': bits->A = value; break;
 
367
        case 'B': bits->B = value; break;
 
368
        case 'C': bits->C = value; break;
 
369
        case 'D': bits->D = value; break;
 
370
        case 'E': bits->E = value; break;
 
371
        case 'F': bits->F = value; break;
 
372
        case 'G': bits->G = value; break;
 
373
        case 'H': bits->H = value; break;
 
374
        case 'I': bits->I = value; break;
 
375
 
 
376
        case 'M': bits->M = value; break;
 
377
        case 'N': bits->N = value; break;
 
378
        case 'O': bits->O = value; break;
 
379
        case 'P': bits->P = value; break;
 
380
        case 'Q': bits->Q = value; break;
 
381
        case 'R': bits->R = value; break;
 
382
        case 'S': bits->S = value; break;
 
383
        }
 
384
}
 
385
 
 
386
EXPORT(int) unpack_bitfields(struct BITS *bits, char name)
 
387
{
 
388
        switch (name) {
 
389
        case 'A': return bits->A;
 
390
        case 'B': return bits->B;
 
391
        case 'C': return bits->C;
 
392
        case 'D': return bits->D;
 
393
        case 'E': return bits->E;
 
394
        case 'F': return bits->F;
 
395
        case 'G': return bits->G;
 
396
        case 'H': return bits->H;
 
397
        case 'I': return bits->I;
 
398
 
 
399
        case 'M': return bits->M;
 
400
        case 'N': return bits->N;
 
401
        case 'O': return bits->O;
 
402
        case 'P': return bits->P;
 
403
        case 'Q': return bits->Q;
 
404
        case 'R': return bits->R;
 
405
        case 'S': return bits->S;
 
406
        }
 
407
        return 0;
 
408
}
 
409
 
 
410
static PyMethodDef module_methods[] = {
 
411
/*      {"get_last_tf_arg_s", get_last_tf_arg_s, METH_NOARGS},
 
412
        {"get_last_tf_arg_u", get_last_tf_arg_u, METH_NOARGS},
 
413
*/
 
414
        {"func_si", py_func_si, METH_VARARGS},
 
415
        {"func", py_func, METH_NOARGS},
 
416
        { NULL, NULL, 0, NULL},
 
417
};
 
418
 
 
419
#define S last_tf_arg_s = (PY_LONG_LONG)c
 
420
#define U last_tf_arg_u = (unsigned PY_LONG_LONG)c
 
421
 
 
422
EXPORT(signed char) tf_b(signed char c) { S; return c/3; }
 
423
EXPORT(unsigned char) tf_B(unsigned char c) { U; return c/3; }
 
424
EXPORT(short) tf_h(short c) { S; return c/3; }
 
425
EXPORT(unsigned short) tf_H(unsigned short c) { U; return c/3; }
 
426
EXPORT(int) tf_i(int c) { S; return c/3; }
 
427
EXPORT(unsigned int) tf_I(unsigned int c) { U; return c/3; }
 
428
EXPORT(long) tf_l(long c) { S; return c/3; }
 
429
EXPORT(unsigned long) tf_L(unsigned long c) { U; return c/3; }
 
430
EXPORT(PY_LONG_LONG) tf_q(PY_LONG_LONG c) { S; return c/3; }
 
431
EXPORT(unsigned PY_LONG_LONG) tf_Q(unsigned PY_LONG_LONG c) { U; return c/3; }
 
432
EXPORT(float) tf_f(float c) { S; return c/3; }
 
433
EXPORT(double) tf_d(double c) { S; return c/3; }
 
434
EXPORT(long double) tf_D(long double c) { S; return c/3; }
 
435
 
 
436
#ifdef MS_WIN32
 
437
EXPORT(signed char) __stdcall s_tf_b(signed char c) { S; return c/3; }
 
438
EXPORT(unsigned char) __stdcall s_tf_B(unsigned char c) { U; return c/3; }
 
439
EXPORT(short) __stdcall s_tf_h(short c) { S; return c/3; }
 
440
EXPORT(unsigned short) __stdcall s_tf_H(unsigned short c) { U; return c/3; }
 
441
EXPORT(int) __stdcall s_tf_i(int c) { S; return c/3; }
 
442
EXPORT(unsigned int) __stdcall s_tf_I(unsigned int c) { U; return c/3; }
 
443
EXPORT(long) __stdcall s_tf_l(long c) { S; return c/3; }
 
444
EXPORT(unsigned long) __stdcall s_tf_L(unsigned long c) { U; return c/3; }
 
445
EXPORT(PY_LONG_LONG) __stdcall s_tf_q(PY_LONG_LONG c) { S; return c/3; }
 
446
EXPORT(unsigned PY_LONG_LONG) __stdcall s_tf_Q(unsigned PY_LONG_LONG c) { U; return c/3; }
 
447
EXPORT(float) __stdcall s_tf_f(float c) { S; return c/3; }
 
448
EXPORT(double) __stdcall s_tf_d(double c) { S; return c/3; }
 
449
EXPORT(long double) __stdcall s_tf_D(long double c) { S; return c/3; }
 
450
#endif
 
451
/*******/
 
452
 
 
453
EXPORT(signed char) tf_bb(signed char x, signed char c) { S; return c/3; }
 
454
EXPORT(unsigned char) tf_bB(signed char x, unsigned char c) { U; return c/3; }
 
455
EXPORT(short) tf_bh(signed char x, short c) { S; return c/3; }
 
456
EXPORT(unsigned short) tf_bH(signed char x, unsigned short c) { U; return c/3; }
 
457
EXPORT(int) tf_bi(signed char x, int c) { S; return c/3; }
 
458
EXPORT(unsigned int) tf_bI(signed char x, unsigned int c) { U; return c/3; }
 
459
EXPORT(long) tf_bl(signed char x, long c) { S; return c/3; }
 
460
EXPORT(unsigned long) tf_bL(signed char x, unsigned long c) { U; return c/3; }
 
461
EXPORT(PY_LONG_LONG) tf_bq(signed char x, PY_LONG_LONG c) { S; return c/3; }
 
462
EXPORT(unsigned PY_LONG_LONG) tf_bQ(signed char x, unsigned PY_LONG_LONG c) { U; return c/3; }
 
463
EXPORT(float) tf_bf(signed char x, float c) { S; return c/3; }
 
464
EXPORT(double) tf_bd(signed char x, double c) { S; return c/3; }
 
465
EXPORT(long double) tf_bD(signed char x, long double c) { S; return c/3; }
 
466
EXPORT(void) tv_i(int c) { S; return; }
 
467
 
 
468
#ifdef MS_WIN32
 
469
EXPORT(signed char) __stdcall s_tf_bb(signed char x, signed char c) { S; return c/3; }
 
470
EXPORT(unsigned char) __stdcall s_tf_bB(signed char x, unsigned char c) { U; return c/3; }
 
471
EXPORT(short) __stdcall s_tf_bh(signed char x, short c) { S; return c/3; }
 
472
EXPORT(unsigned short) __stdcall s_tf_bH(signed char x, unsigned short c) { U; return c/3; }
 
473
EXPORT(int) __stdcall s_tf_bi(signed char x, int c) { S; return c/3; }
 
474
EXPORT(unsigned int) __stdcall s_tf_bI(signed char x, unsigned int c) { U; return c/3; }
 
475
EXPORT(long) __stdcall s_tf_bl(signed char x, long c) { S; return c/3; }
 
476
EXPORT(unsigned long) __stdcall s_tf_bL(signed char x, unsigned long c) { U; return c/3; }
 
477
EXPORT(PY_LONG_LONG) __stdcall s_tf_bq(signed char x, PY_LONG_LONG c) { S; return c/3; }
 
478
EXPORT(unsigned PY_LONG_LONG) __stdcall s_tf_bQ(signed char x, unsigned PY_LONG_LONG c) { U; return c/3; }
 
479
EXPORT(float) __stdcall s_tf_bf(signed char x, float c) { S; return c/3; }
 
480
EXPORT(double) __stdcall s_tf_bd(signed char x, double c) { S; return c/3; }
 
481
EXPORT(long double) __stdcall s_tf_bD(signed char x, long double c) { S; return c/3; }
 
482
EXPORT(void) __stdcall s_tv_i(int c) { S; return; }
 
483
#endif
 
484
 
 
485
/********/
 
486
 
 
487
#ifndef MS_WIN32
 
488
 
 
489
typedef struct {
 
490
        long x;
 
491
        long y;
 
492
} POINT;
 
493
 
 
494
typedef struct {
 
495
        long left;
 
496
        long top;
 
497
        long right;
 
498
        long bottom;
 
499
} RECT;
 
500
 
 
501
#endif
 
502
 
 
503
EXPORT(int) PointInRect(RECT *prc, POINT pt)
 
504
{
 
505
        if (pt.x < prc->left)
 
506
                return 0;
 
507
        if (pt.x > prc->right)
 
508
                return 0;
 
509
        if (pt.y < prc->top)
 
510
                return 0;
 
511
        if (pt.y > prc->bottom)
 
512
                return 0;
 
513
        return 1;
 
514
}
 
515
 
 
516
typedef struct {
 
517
        short x;
 
518
        short y;
 
519
} S2H;
 
520
 
 
521
EXPORT(S2H) ret_2h_func(S2H inp)
 
522
{
 
523
        inp.x *= 2;
 
524
        inp.y *= 3;
 
525
        return inp;
 
526
}
 
527
 
 
528
typedef struct {
 
529
        int a, b, c, d, e, f, g, h;
 
530
} S8I;
 
531
 
 
532
EXPORT(S8I) ret_8i_func(S8I inp)
 
533
{
 
534
        inp.a *= 2;
 
535
        inp.b *= 3;
 
536
        inp.c *= 4;
 
537
        inp.d *= 5;
 
538
        inp.e *= 6;
 
539
        inp.f *= 7;
 
540
        inp.g *= 8;
 
541
        inp.h *= 9;
 
542
        return inp;
 
543
}
 
544
 
 
545
EXPORT(int) GetRectangle(int flag, RECT *prect)
 
546
{
 
547
        if (flag == 0)
 
548
                return 0;
 
549
        prect->left = (int)flag;
 
550
        prect->top = (int)flag + 1;
 
551
        prect->right = (int)flag + 2;
 
552
        prect->bottom = (int)flag + 3;
 
553
        return 1;
 
554
}
 
555
 
 
556
EXPORT(void) TwoOutArgs(int a, int *pi, int b, int *pj)
 
557
{
 
558
        *pi += a;
 
559
        *pj += b;
 
560
}
 
561
 
 
562
#ifdef MS_WIN32
 
563
EXPORT(S2H) __stdcall s_ret_2h_func(S2H inp) { return ret_2h_func(inp); }
 
564
EXPORT(S8I) __stdcall s_ret_8i_func(S8I inp) { return ret_8i_func(inp); }
 
565
#endif
 
566
 
 
567
#ifdef MS_WIN32
 
568
/* Should port this */
 
569
#include <stdlib.h>
 
570
#include <search.h>
 
571
 
 
572
EXPORT (HRESULT) KeepObject(IUnknown *punk)
 
573
{
 
574
        static IUnknown *pobj;
 
575
        if (punk)
 
576
                punk->lpVtbl->AddRef(punk);
 
577
        if (pobj)
 
578
                pobj->lpVtbl->Release(pobj);
 
579
        pobj = punk;
 
580
        return S_OK;
 
581
}
 
582
 
 
583
#endif
 
584
 
 
585
 
 
586
static struct PyModuleDef _ctypes_testmodule = {
 
587
        PyModuleDef_HEAD_INIT,
 
588
        "_ctypes_test",
 
589
        NULL,
 
590
        -1,
 
591
        module_methods,
 
592
        NULL,
 
593
        NULL,
 
594
        NULL,
 
595
        NULL
 
596
};
 
597
 
 
598
PyMODINIT_FUNC
 
599
PyInit__ctypes_test(void)
 
600
{
 
601
        return PyModule_Create(&_ctypes_testmodule);
 
602
}