FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour using a Python module from Harbour according to IA
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
using a Python module from Harbour according to IA
Posted: Wed Dec 14, 2022 06:54 PM
generated using https://beta.openai.com/playground
Code (fw): Select all Collapse
#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 );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: using a Python module from Harbour according to IA
Posted: Tue Mar 21, 2023 09:23 PM
Using Python from Harbour, working :-)

https://github.com/FiveTechSoft/harbour_python
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
Re: using a Python module from Harbour according to IA
Posted: Mon Mar 27, 2023 12:30 PM

Wow!

Good news, today I'm using Chilkat because I need some features that Harbour don't have, for example XmlDSigGen,

using Pyton for sure there are no limitation to do this.

Thank you Antonio, best regards.

Continue the discussion