小编典典
事情并不像人们想象的在1个那样容易ST一目了然。我将发布一个虚拟示例,该示例恰好包含使用 .dll s( .so
s)中的函数的2种方式(如[Python 3.Docs]中所述:ctypes-
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) {
PRI