Commit 3bb8bd2f authored by Mark Florisson's avatar Mark Florisson

Fix callingconvention test

parent 9928cff1
#ifdef __cplusplus
extern "C" {
#endif
extern DL_EXPORT(int) f1(void);
extern DL_EXPORT(int) __cdecl f2(void);
extern DL_EXPORT(int) __stdcall f3(void);
extern DL_EXPORT(int) __fastcall f4(void);
#ifdef __cplusplus
}
#endif
int f1(void) {return 0;}
int __cdecl f2(void) {return 0;}
int __stdcall f3(void) {return 0;}
int __fastcall f4(void) {return 0;}
#ifdef __cplusplus
extern "C" {
#endif
extern int (*p1)(void);
extern int (__cdecl *p2)(void);
extern int (__stdcall *p3)(void);
extern int (__fastcall *p4)(void);
#ifdef __cplusplus
}
#endif
int (*p1)(void);
int (__cdecl *p2)(void);
int (__stdcall *p3)(void);
int (__fastcall *p4)(void);
# mode: compile
cdef extern from "callingconvention.h":
pass
cdef extern int f1()
cdef extern int __cdecl f2()
cdef extern int __stdcall f3()
cdef extern int __fastcall f4()
cdef extern int (*p1)()
cdef extern int (__cdecl *p2)()
cdef extern int (__stdcall *p3)()
cdef extern int (__fastcall *p4)()
p1 = f1
p2 = f2
p3 = f3
p4 = f4
PYTHON setup.py build_ext --inplace
PYTHON -c "import callingconvention"
######## setup.py ########
from distutils.core import setup
from Cython.Distutils import build_ext
from Cython.Distutils.extension import Extension
setup(
ext_modules = [
Extension("callingconvention", ["callingconvention.pyx", "external_callingconvention.c"]),
],
cmdclass={'build_ext': build_ext},
)
######## callingconvention.pyx ########
# mode: compile
cdef extern from "external_callingconvention.h":
pass
cdef extern int f1()
cdef extern int __cdecl f2()
cdef extern int __stdcall f3()
cdef extern int __fastcall f4()
cdef extern int (*p1)()
cdef extern int (__cdecl *p2)()
cdef extern int (__stdcall *p3)()
cdef extern int (__fastcall *p4)()
p1 = f1
p2 = f2
p3 = f3
p4 = f4
######## external_callingconvention.h ########
#ifdef __cplusplus
extern "C" {
#endif
extern DL_IMPORT(int) f1(void);
extern DL_IMPORT(int) __cdecl f2(void);
extern DL_IMPORT(int) __stdcall f3(void);
extern DL_IMPORT(int) __fastcall f4(void);
extern DL_IMPORT(int) (*p1)(void);
extern DL_IMPORT(int) (__cdecl *p2)(void);
extern DL_IMPORT(int) (__stdcall *p3)(void);
extern DL_IMPORT(int) (__fastcall *p4)(void);
#ifdef __cplusplus
}
#endif
######## external_callingconvention.c ########
#include <Python.h>
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
DL_EXPORT(int) f1(void) {return 0;}
DL_EXPORT(int) __cdecl f2(void) {return 0;}
DL_EXPORT(int) __stdcall f3(void) {return 0;}
DL_EXPORT(int) __fastcall f4(void) {return 0;}
DL_EXPORT(int) (*p1)(void);
DL_EXPORT(int) (__cdecl *p2)(void);
DL_EXPORT(int) (__stdcall *p3)(void);
DL_EXPORT(int) (__fastcall *p4)(void);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment