Embedding Python in C
On Wednesday, July 17, 2019 at 11:55:28 AM UTC-6, Barry Scott wrote:
> > On 17 Jul 2019, at 16:57, wrote:
> > I am using Python3.6:
> > [jibarra at redsky ~]$ python3.6
> > Python 3.6.8 (default, Apr 25 2019, 21:02:35)
> > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> > I am referencing:https://docs.python.org/3.6/extending/embedding.html#beyond-very-high-level-embedding-an-overview
> > Is there a way to call a shared C lib using PyObjects?
> If what you want to call is simple enough then you can use the ctypes library
> that ships with python.
> If the code you want to call is more complex you will want to use one of a number of libraries to help
> you create a module that you can import.
> I use PyCXX for this purpose that allows me to write C++ code that can call C++ and C libs and interface
> easily with python. Home page http://cxx.sourceforge.net/ <http://cxx.sourceforge.net/> the source kit contains demo code that you shows
> how to cerate a module, a class and function etc.
> Example code: https://sourceforge.net/p/cxx/code/HEAD/tree/trunk/CXX/Demo/Python3/simple.cxx <https://sourceforge.net/p/cxx/code/HEAD/tree/trunk/CXX/Demo/Python3/simple.cxx>
> PyCXX maintainer
> > Please advise.
> > Thank you.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
My options seem rather limited, I need to make a Pipeline from (Smalltalk -> C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does not support Python directly I have to settle with the C/Python API (https://docs.python.org/3.6/extending/embedding.html#beyond-very-high-level-embedding-an-overview). Any suggestions?