一、python3库准备
安装python的时候要加 --enable-shared,否则不会生成和python相关的xxx.so动态链接库文件,
而且最好安装在/usr下面,而不是/usr/local/,这样的话需要的Python.h头文件就会在/usr/include/Python3.7m,除此之外,还需要svdpi.h头文件,这个文件目录在${VCS_HOME}/include下面。
./configure --prefix=/usr/local/python3 --enable-shared //./configure --prefix=/usr/python3 --enable-shared
二、编译
文件./soft/c_call_py.cpp
//./soft/c_call_py.cpp #include#include #include #include //#define PYTHON_PATH "/home/ICer/workspace/systemverilog-python-main/1.systemverilog_demo/soft" //#ifndef PYTHON_PATH //#error You must define the PYTHONPATH to the python file in gcc compiler with -D //#endif static PyObject *pModule = NULL; static PyObject *pFunc = NULL; static



