per page, with , order by , clip by
Results of 1 - 2 of about 2 for fprintf (0.003 sec.)
1. 他のアプリケーションへの Python の埋め込み 11228
1. 他のアプリケーションへの Python の埋め込み 前章では、 Python を拡張する方法、すなわち C 関数のライブラリを Python に結びつけて機能を拡張する方法について述べました。同じようなことを別の方法でも実行できます: それは、自分の C/C++ アプリケー ... argc , char * argv []) { PyObject * pName , * pModule , * pFunc ; PyObject * pArgs , * pValue ; int i ; if ( argc < 3 ) { fprintf ( stderr , "Usage: call pythonfile funcname [args] \n " ); return 1 ; } Py_Initialize (); pName = PyUnicode_DecodeFSDefaul ... ++ i ) { pValue = PyLong_FromLong ( atoi ( argv [ i + 3 ])); if ( ! pValue ) { Py_DECREF ( pArgs ); Py_DECREF ( pModule ); fprintf ( stderr , "Cannot convert argument \n " ); return 1 ; } /* ここで pValue の参照が盗まれる: */ PyTuple_SetItem ( pArgs , i ... " , PyLong_AsLong ( pValue )); Py_DECREF ( pValue ); } else { Py_DECREF ( pFunc ); Py_DECREF ( pModule ); PyErr_Print (); fprintf ( stderr , "Call failed \n " ); return 1 ; } } else { if ( PyErr_Occurred ()) PyErr_Print (); fprintf ( stderr , "Cannot f ...
https://man.mtool.work/python/3.14/extending/embedding.html
1. Extending Python with C or C++ 7485
1. Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can't be done directly in Python: they can implement new built-in objec ... config ); /* Add a built-in module, before Py_Initialize */ if ( PyImport_AppendInittab ( "spam" , PyInit_spam ) == -1 ) { fprintf ( stderr , "Error: could not extend in-built modules table \n " ); exit ( 1 ); } /* Pass argv[0] to the Python interpreter ... e embedded script imports it. */ PyObject * pmodule = PyImport_ImportModule ( "spam" ); if ( ! pmodule ) { PyErr_Print (); fprintf ( stderr , "Error: could not import module 'spam' \n " ); } // ... use Python C API here ... return 0 ; exception : PyConf ...
https://man.mtool.work/python/3.14/extending/extending.html
PREV 1 NEXT