Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6550599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:14:06+00:00 2026-05-25T12:14:06+00:00

Ok, quick, and hopefully easy question here… I have a large C++ API that

  • 0

Ok, quick, and hopefully easy question here…

I have a large C++ API that is basically a sockets API with a top level XML type protocol. This is a distributed source package from a company. All of the source code is written into header files (including function implementations) for some odd reason (I guess they figure it is easier for developers to import an H file and not have to worry about compiling multiple cpp files??). The source is also available in C, Java, and .NET.

The application that I am writing is in Python, on Linux, and needs to use this API through Python. My three options seem to be either running the applications separately with a message passing protocol between them, running SWIG (or similar) to generate a Python hook-in, or to reimplement all the source code into Python. Ultimately, I’d like to make it as asynchronous as possible (already using Twisted in other parts of the application).

Using SWIG seems to be the quickest, but there are many custom typed structures that are used in passing in and out of functions, as well as returns from functions, which I have heard can be a bit of an issue with SWIG.

I’d rather not have to write a message protocol as that creates another point of failure and two different source codes, in two different languages, that I have to manage. Reimplementing the C++ code in Python may ultimately be a good solution, but that is going to require a large amount of effort and time.

My question is, does SWIG seem like a good idea, and if so, will I need to write C++ files to compile that wrap the headers, or should I just forget SWIG and look into something else?

I appreciate any help or thoughts. Thanks.

EDIT: Turns out I misspoke earlier…there is a lot of the source code in header files, but I found a bunch of .lib and .a files as well. Is it possible to use SWIG, Boost, or similar on these types of files included? Or do I need to write a top level API over those and try that way? So far my attempts have failed miserably.

SOLUTION: I ended up just implementing my own API straight from Python. Turns out that the protocol spec was not that complex and the C++ libraries actually made it more difficult than it needed to be. I also have the added bonus of building the lib inside an asynchronous framework, instead of having to do threading with the synchronous calls.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:14:07+00:00Added an answer on May 25, 2026 at 12:14 pm

    SWIG would usually be my preferred solution for problems like this. “Custom typed” structures can be wrapped perfectly sensibly. The thing you will need to watch out for though is the limitations of the SWIG parser if you’ve got everything in the header files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

quick and hopefully easy question. Let's say I have a variable that is equal
I have a quick and hopefully simple question that I hope someone can help
I have a quick question that hopefully someone has worked through before. In the
Hopefully this is a quick and easy question to answer. I have a MySQL
Just a quick regex question...hopefully I have a string that looks something like this:
I have a (hopefully) quick SQL question that is driving me nuts and I
Quick (and hopefully easy) question: I need to trigger a download of a PDF
Just a (hopefully) quick question, I have the following HTML code: <tr> <td><img src=img/icons/file_pdf.png></td>
Quick question. What do you think, I have a few sites that use a
Hopefully a quick python question here... import plistlib pl = plistlib.readPlist('/Users/name/Documents/some.plist') print(pl[0]['keyA'] , pl[0]['keyD']

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.