per page, with , order by , clip by
Results of 1 - 2 of about 2 for pModule (0.002 sec.)
1. 他のアプリケーションへの Python の埋め込み 11228
1. 他のアプリケーションへの Python の埋め込み 前章では、 Python を拡張する方法、すなわち C 関数のライブラリを Python に結びつけて機能を拡張する方法について述べました。同じようなことを別の方法でも実行できます: それは、自分の C/C++ アプリケー ... のようになります: #define PY_SSIZE_T_CLEAN #include <Python.h> int main ( int argc , char * argv []) { PyObject * pName , * pModule , * pFunc ; PyObject * pArgs , * pValue ; int i ; if ( argc < 3 ) { fprintf ( stderr , "Usage: call pythonfile funcname [a ... \n " ); return 1 ; } Py_Initialize (); pName = PyUnicode_DecodeFSDefault ( argv [ 1 ]); /* pName のエラーチェックは省略 */ pModule = PyImport_Import ( pName ); Py_DECREF ( pName ); if ( pModule != NULL ) { pFunc = PyObject_GetAttrString ( pModule , argv ... argc - 3 ; ++ 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 ...
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 ... /* Optionally import the module; alternatively, import can be deferred until the embedded script imports it. */ PyObject * pmodule = PyImport_ImportModule ( "spam" ); if ( ! pmodule ) { PyErr_Print (); fprintf ( stderr , "Error: could not import module ...
https://man.mtool.work/python/3.14/extending/extending.html
PREV 1 NEXT