- Code: Select all Expand view
- #include "hbapi.h"
HB_FUNC( MAIN )
{
Py_Initialize();
PyObject* pName;
pName = PyString_FromString( ( char * ) "my_module" );
PyObject* pModule;
pModule = PyImport_Import( pName );
PyObject* pDict;
pDict = PyModule_GetDict( pModule );
PyObject* pFunc;
pFunc = PyDict_GetItemString( pDict, ( char * ) "my_function" );
PyObject* pArgs;
pArgs = PyTuple_New( 1 );
PyObject* pValue;
pValue = PyInt_FromLong( 1 );
PyTuple_SetItem( pArgs, 0, pValue );
PyObject_CallObject( pFunc, pArgs );
Py_DECREF( pName );
Py_DECREF( pArgs );
Py_DECREF( pModule );
Py_Finalize();
hb_retl( HB_TRUE );
}