Embedding Python27 in C++ on Windows: CRT compatibility issues with VS2010?

Mark Hammond skippy.hammond at gmail.com
Thu May 24 21:53:59 EDT 2012


On 25/05/2012 2:10 AM, Stephen Lin wrote:
> Hello,
>
> I'm a relative python newbie but I've been tasked to figure out how to
> embed calls to a python library in an Excel XLL add-in.
>
> The Python/C API for doing this seems pretty straightforward, but I
> seem to have read somewhere online that it's important that the C++
> program or DLL linking to and embedding Python must be using the same
> CRT as what the Python implementation dll is using. Is this true, or
> is the Python API written in such a way that there is no dependency on
> a common CRT?

It depends on the APIs you use.  eg, some APIs take a "FILE *" and some 
may take ownership of memory - such APIs needs to use the same CRT. 
APIs that don't attempt to share CRT "objects" should be fine.

Mark
>
> If there is a dependency, does that mean that I cannot use VS2010 to
> develop this XLL, but should use VS2008 instead, or are there other
> workarounds?
>
> Thanks for the help,
> Stephen
>





More information about the Python-list mailing list