Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wrapping c/c++ dll
#1
I have a piece of hardware with a C/C++ api in the form of a dll, but I'm unsure what the best option is to make that code useable with python.

I experimented a bit with ctypes on a simple dll I wrote, but the library I want to use has around 30+ functions which will likely be a huge hassle to manually wrap and test every single one of them.
SWIG or CPython bindings seem to offer something more automated, but every example I found seems to build from the .cpp source file, which I do not have.

Any recommendations?
Reply
#2
(Aug-25-2023, 12:14 PM)Oolongtea Wrote: every example I found seems to build from the .cpp source file, which I do not have.
I think you'll need at least the header files for the interface. You could try pybind11 or PyBindGen perhaps.
Reply
#3
I use boost::python for embedded, works really well
caveat, it’s part of boost which is quite big, pybind11 is header only, might be the way to go.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 1,936 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  xml indent SubElements (wrapping) with multiple strings ctrldan 2 1,516 Jun-09-2023, 08:42 PM
Last Post: ctrldan
  wrapping c++ library JESuh 2 1,327 Jun-16-2022, 08:18 AM
Last Post: JESuh
  Help Wrapping C Library LeftyGuitar 2 1,869 Oct-06-2019, 08:04 PM
Last Post: micseydel
  wrapping problem ibaad1406 2 2,039 Jun-19-2019, 07:22 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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