|
|
|
Выполнение кода Python из приложения
|
|||
|---|---|---|---|
|
#18+
Добрый день || вечер || …! Не подскажете, почему приложение (исх. код ниже) при запуске вываливается и не работает??? #include <windows.h> void msb() { ::MessageBox(NULL,"OK","OK",MB_OK); } #include <Python.h> #pragma comment(lib, "python23.lib") static PyObject *pp(PyObject *self, PyObject *args) { msb(); return Py_BuildValue("s", "ok"); } static struct PyMethodDef ppm[]={ {"msd", pp, 1}, {NULL,NULL} }; void initpp() { Py_InitModule("pm",ppm); } #include <stdio.h> void main(int argc, char *argv[]) { Py_Initialize(); initpp(); // PyRun_SimpleString("import pm\npm.msd()"); // так работает FILE *fff=fopen("1.py","r"); PyRun_SimpleFile(fff, "1.py"); // а так выпадает Py_Finalize(); } ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.02.2006, 10:08 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=33554975&tid=2031912]: |
0ms |
get settings: |
10ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
149ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
30ms |
get tp. blocked users: |
1ms |
| others: | 222ms |
| total: | 435ms |

| 0 / 0 |
