1

I have some code here that we used to use to call a Python script from our (very large) application. It worked fine when we used VS2008 (compiler v90), which is what the default version of python27 was compiled with.

In the last year we've upgraded our application to VS2010, and I was looking to update the Python-calling dll, thinking it would be a morning's work. Unfortunately, after wrestling with the linker and missing dlls for ages, most of my colleagues agree that our application and python27.dll are using incompatible versions of Windows CRT.

I thought it would be simple enough to find a version of python27.dll (or indeed another version would be fine) compiled with VS2010 (v100) - but I can't.

Is there a way to call a Python script from an application compiled in VS2010?

NorthCat
  • 9,643
  • 16
  • 47
  • 50
Mike Sadler
  • 1,750
  • 1
  • 20
  • 37

2 Answers2

2

An answer may be: Download the python sources - compile a custom python.dll and link against that.

  • I was really hoping that wasn't going to be the answer. So every other person running Python from C++ is using the same compiler as Python happened to chose? – Mike Sadler Sep 26 '13 at 15:43
  • @MikeSadler Using Linux makes it easy (I do not care about it), sorry ;-) –  Sep 26 '13 at 15:52
  • With some reluctance I have to accept this as the correct solution. For other people's reference: 1) Download the appropriate tarball 2) Find the folder 'PCBuild' 3) Upgrade the pcbuild.sln to the latest version of Visual Studio. To the credit of the Python authors and MS, this seems to work out-of-the-box. – Mike Sadler Oct 01 '13 at 14:18
2

I have the same problem. The solution is indeed to build python from the sources. But there is a big drawback: all extra 3rd party python modules pre-build for Windows that you download from internet will not work! This is because all of those modules will be prebuild with VS 2008 and you get again in trouble with incompatible runtimes. The solution is that all such extra modules needs to be again rebuild from sources, but the task is not easy in all cases. The modules are ususally tested in VS2008 and you get a lot of troubles trying to run them with VS2010. I got this mostly with database connectors for MySQL, MSSQL and others.

NorthCat
  • 9,643
  • 16
  • 47
  • 50
mariosoft
  • 29
  • 2
  • Yes - sorry, I forgot to mention that! I actually only needed the basic libraries, so I just didn't bother compiling all of the 3rd party libraries. – Mike Sadler Jul 01 '14 at 13:39