0

How to use C++ compiled code in a python program?

I usually do the interface with text files. Is there a way to call C++ compiled code directly from python, using variables in memory?

2nd Aug 2017, 5:49 PM
Denis Felipe
Denis Felipe - avatar
1 Resposta
+ 4
Have you heard about ctypes - a foreign function library for Python? It provides C/C++ compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python. It's as simple as: Write your C++ code, compile it as a shared library. Use ctypes to prepare a wrapper for your created library and run! Voila!
2nd Aug 2017, 8:05 PM
Saka Oluwadamilola
Saka Oluwadamilola - avatar