64865

MSVC - boost::python static linking to .dll (.pyd)

Question:

I got a VS10 project. I want to build some C++ code so I can use it in python. I followed the boost tutorial and got it working. However VS keeps to link boost-python-vc100-mt-gd-1_44.lib but it's just a wrapper which calls boost-python-vc100-mt-gd-1_44.dll. That's why I need to copy the .dll with my .dll(.pyd) file. So I want to link boost:python statically to that .dll(.pyd) file. But I just can't find any configuration option in VS or in the compiler and linker manual. The weirdest thing is I've got one older project using boost::filesystem with the very same config but that project links against libboost-filesystem-*.lib which is static lib so it's ok. I've been googling for couple of hours without any success and it drivers me crazy.

Thanks for any help or suggestion.

Answer1:

What libraries are linked depends on the settings of your project. There are two possibilities: You can build against

<ol><li>statically</li> <li>dynamically</li> </ol>

linked versions of the c-runtime libs. Depending on which option is selected, the boost sends a proper #pragma to the linker. These options need to be set consistently in all projects which constitute your program. So go to "properties -> c++ -> code generation" (or similar, I am just guessing, don't have VS up and running right now) and be sure that the right option is set (consistently). Of course, you must have compiled boost libraries in required format before...

Answer2:

You probably don't want to do that. Statically linked Boost python has a number of problems and quirks when there are more then one boost python based library imported. "But I only have one" you say. Can you guarantee that your users won't have another? That you might want to use another in the future? Stick with the DLL. Distributing another DLL is really not that big a deal. Just put it side-by-side in the same directory.

Recommend

  • How to approach parsing through a javascript file?
  • Error installing pyV8 from source on ubuntu
  • Django Admin Links Disabled on Heroku
  • Serialize JSON array from a web request
  • ES6 imports in Node with --experimental-modules
  • For loops being skipped without cause in VBA
  • Focus textarea with caret after text in Android browser
  • Plot: color all larger than different color
  • Django Admin wont allow me to allocate permissions to Users or Groups
  • python regex [:alpha:]
  • Model to match this JSON for deserialization, field names with dashes
  • RegularExpressionValidator With DropDownList(asp.net)
  • Filter Values of Current Week with XQuery
  • C++ mySQL connector LINKER errors (Windows)
  • “Complex Header” not responsive in current DataTables.net build?
  • Entity Framework Core: Include many-to-many related objects in WebAPI
  • Laravel Impossible to Create Root Directory
  • How to get to older Xcode beta version?
  • How to protect the mp3 file from read or copy on Android?
  • Mapping two workspace folders to the same working directory
  • Is mp4 stream able with ffserver?
  • Python/Javascript: WYSIWYG html editor - Handle large documents fast and/or design theory
  • SQL: Getting the physical size of a subset of a table
  • IE10 strips out hashtag from the URL
  • how to populate a SQLite database and use that database in phonegap?
  • Is there a way to dynamically embed PDF Files in a JSP pulled from the file system?
  • Spring Cloud Microservice Architecture Confusion
  • error importing numpy
  • Google Custom Search with transparent background
  • How can I send an e-mail from a vbs script
  • vba code to select only visible cells in specific column except heading
  • Invalid access key error using credentials redeemed from an amazon open id token
  • Circular dependency while pushing http interceptor
  • Is there a mandatory requirement to switch app.yaml?
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • C# - Getting references of reference
  • -fvisibility=hidden not passed by compiler for Debug builds
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • UserPrincipal.Current returns apppool on IIS
  • To Get the radio button value in ruby on rails