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

  • Home
  • SEARCH
  • 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 8797663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:53:50+00:00 2026-06-13T23:53:50+00:00

I have a dll written in C++ that I want to export to Python

  • 0

I have a dll written in C++ that I want to export to Python for running regression and unit-testing (it’s just easier to maintain and run the regression with Python).
To this purpose I want to use Boost.Python to export the main API of the dll so it will be usable in Python.
My assemblies look as follows:

  1. MyLibrary.dll //main API C++ library
  2. MyLibrary.pyd //a thin dll project containing only the BOOST_PYTHON_MODULE export definitions (dependant on MyLibrary.dll)
  3. … //other C++ dll files that MyLibrary.dll is dependent on

I had some trouble getting MyLibrary.pyd to link but after digging through questions a bit (e.g. here) I realised I had to re-build boost while pointing b2.exe to my specific Python version. After which I was able to import and run my library from python (on my machine alone).

Technical data: I’m building the libraries with boost 1.51, Python 3.23 on Windows 7 x64 and MSVC-10.0 (my own projects are built from VS2010). The variant I’m using to link with boost is shared libraries, 64 address model, release accordingly with my own builds.

The problem is, when I try to import the library (built on my machine) on another machine, python complains:

ImportError: DLL load failed: The specified procedure could not be found.

On the line import MyLibrary

Which begs the following questions:

  1. Is the MyLibrary.pyd I built on my machine “python-portable”? Meaning, will it work on other versions of Python besides 3.23 (the version I used to build boost.python with on my machine)?
  2. Does the user of MyLibrary.pyd have to re-build boost with his own version of python in order to be able to successfully import it?
  3. So far we’ve been using the pre-built boost installer for windows supplied by BoostPro. What version of Python is that build linked against and can I save my users the headache of building boost on their own if we simply decide to work with the “right” version of Python across the team (the version BoostPro linked against)?
  • 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-06-13T23:53:51+00:00Added an answer on June 13, 2026 at 11:53 pm

    Take a look at PEP 384 at http://docs.python.org/3.2/whatsnew/3.2.html.

    http://www.boost.org/doc/libs/1_52_0/libs/python/doc/news.html shows that there hasn’t been any real progress lately so I doubt that Boost.Python supports or was at least tested with Py_LIMITED_API defined.

    According to my experience with Python 2.x compatibility using both Boost.Python and PyCXX (I haven’t worked with 3.x line yet):

    1. No it won’t. Only micro version changes stay ABI portable.
    2. Not exactly. The user of a MyLibrary.pyd binary provided by you won’t be able to load it using different major/minor python version. The build configuration of Boost she has does not matter. You need to have Boost.Python builds with every minor Python version you want to support. That includes separate builds for 32 and 64 bit Python installations.

    My advice is to try to build Boost from source with Py_LIMITED_API defined. I do not guarantee that it will succeed, but it’s worth a try.

    If it fails ask your teammates to use the same Python version as you and of course a x64 bit Windows (since the .pyd is 64bit itself). Or even better setup a CI machine that will build your python module in every required configuration so that your clients will be able to choose a proper binary. Let your teammates build and use their own versions of MyLibrary.pyd for their local use only.

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

Sidebar

Related Questions

I have a DLL that is written in C++ and I want to suppress
I have a script written in tcl, that load a dll file. I want
I have written a program that utilizes 2 3rd party dll's and I want
I have a test suite DLL written in C# that uses Selenium.This is then
I have an application written in PHP that uses a COM dll written in
I have a very simple DLL written in unmanaged C++ that I access from
I have a DLL, written in XE2 that takes a PChar as a parameter
I have written a c# program that calls a c++ dll that echoes the
I have an MFC extension DLL that I've written. It contains derived classes of
I have a program written in VB.Net (Visual Studio 2008) that uses a DLL

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.