The premise already has. C and. I files
Compiled a. i file with Swid generates a WRAP.C file and a. py file
VC Create DLL Project
Add. h to the header file. c files and wrap.c files add the. i file to the project directory in the source file
Tools->options-> Modify include and Lib in directories add Python include and Libs
copy \libs\python27.lib and rename to Python27_d.lib
Modify Pyconfig.h (I only modified the previous two without modification and succeeded)
#ifdef _DEBUG
# define Py_debug
#endif
for #ifdef _DEBUG
//# define Py_debug
#end If
Modify
# ifdef _DEBUG
# pragma comment (lib, "Python24_d.lib")
# Else
# pragma comment (lib, "Python24.lib"
# endif/* _DEBUG * *
for
# ifdef _DEBUG
# pragma comment (lib, "Python24.lib")
# Else
# pragma commen T (Lib, "Python24.lib")
# endif/* _DEBUG * *
Modify object.h
Modify
#if defined (py_debug) &&!defined (py_ trace_refs)
#define PY_TRACE_REFS
#endif
to
#if defined (py_debug) &&!defined (py_trace_refs)
//#define PY_TRACE_REFS
#endif
Change the generated name.dll file to _name.pyd put the preceding. Py and _name.pyd files in a file (only. pyd files are available when I try)
Create a new test file:
Import name
AA = name.somefunction ()
Print (AA)
Generate DLL files that can be called by Python using VC