事情并不像人们一眼就能想到的那么简单。我将发布一个虚拟示例,它碰巧包含两种处理.dlls(.sos)函数的方法(如[Python 3.Docs]: ctypes - A foreign function library for Python中所述)。在
dll00.c:#include
#if defined(_WIN32)
# define DLL00_EXPORT __declspec(dllexport)
# pragma warning(disable: 4477) // !!! Just to avoid having additional code (macro for size_t), do NOT do this !!!
#else
# define DLL00_EXPORT
#endif
#define PRINT_MSG_0() printf(" [%s] (%d) - [%s]\n", __FILE__, __LINE__, __FUNCTION__)
#define PRINT_MSG_1I(ARG0) printf(" [%s] (%d) - [%s]: ARG0: %d\n", __FILE__, __LINE__, __FUNCTION__, ARG0)
static int IsValidInt(int i) {
PRINT_MSG_1I(i);
return -i;
}
static int InvalidInt() {
PRINT_MSG_0();
return 0;
}
static int IsValidSize (size_t i) {
PRINT_MSG_1I(i);
return -i;</