Как встроить скрипт Python в C ++? - PullRequest
0 голосов
/ 10 ноября 2019

Я встраиваю скрипт на веб-сканере python в C ++. C ++ будет использоваться для ввода URL-адресов и полей веб-сайта, я могу изменить метод вывода, который будет управляться с помощью C ++. Я застрял в создании C ++ части.

Как мне реализовать это с помощью моего скрипта веб-очистки?

`static int numargs = 0;

/* Return the number of arguments of the application command line */
static PyObject*
emb_numargs(PyObject *self, PyObject *args)
{
    if(!PyArg_ParseTuple(args, ":numargs"))
    return NULL;
    return PyLong_FromLong(numargs);
 }

 static PyMethodDef EmbMethods[] = {
     {"numargs", emb_numargs, METH_VARARGS,
      "Return the number of arguments received by the process."},
     {NULL, NULL, 0, NULL}
  };

  static PyModuleDef EmbModule = {
         PyModuleDef_HEAD_INIT, "emb", NULL, -1, EmbMethods,
         NULL, NULL, NULL, NULL
    }

 static PyObject*
 PyInit_emb(void)
 {
    return PyModule_Create(&EmbModule);
}

`

...