Python Forum
C/C++ extension as an executable, not a library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C/C++ extension as an executable, not a library
#1
I have a python application which I package with "python -m build", then install with "pip install mystuff.tar.gz", and that works well. In the past I've added C code that links in at runtime to extend Python, that works fine too.

But now I need to use a C++ library that doesn't play well as part of a Python application, so I'd like to write a C++ program that gets executed with Popen() at runtime, then communicates with the main Python application via stdin/stdout. I can build and run this, but I can't figure out how to bundle it with the pip package so that it gets compiled into an executable at "pip install" time. I can find lots of examples of putting ext_modules into setup.py to create linkable extensions, but is there some way to make an executable out of this? Worst case, the Python application can execute something like f"gpp {__file__}/app.o -o {tempfile.mktemp()}", then execute the tempfile...but there's got to be a better way. Right?

Thanks for any help that people can give.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,839 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020