From: Scott A. Smith (ssmith_at_[hidden])
Date: 2002-09-19 10:42:30
I am using MSVC++ Version 6 with SP5 under Windows 2K with Boost 1.28.0.
Ive built the Boost.Python library using Jam with MSVC++ - no problems.
Ive built my project using MSVC++ in the MSVC++ IDE as both a static library
& DLL - no problems.
Ive built my project using MSVC++ in its IDE as a DLL linking to the
Boost.Python DLL - problems.
The problems are not in the build, they occur when using the DLL. When I
construct a simple class (in Python) that takes a std::string as a argument
I get a "Debug Assertion Failed" message from windows with an indication
that the problem lies in dbgheap.c. After weeks of fun times playing with
MSVC++ in building a plain DLL (no Boost.Python) of my project, I learned
that such problems can occur when libraries and executables use different or
improper versions of the C runtime library (CRT). Then programs can become
confused over how to delete objects as complicated as std::string and
produce the error I indicated. I avoid such problems by building my
(non-Pythonized) DLL, and linking any programs using it, to the "proper" CRT
libs. However, this solution does not work my project's Pythonized DLL. Most
everything in the Pythonized DLL seems to work fine, I can run lots of
Python commands using my exported functions, but I always get crashes when I
invoke these pesky constructors.
A couple months back I reported my problem with using exported construtors
that take a string argument, and Dave was kind enough to test my example
code. It worked perfectly for him using Jam (and subsequently for me too
using Jam). But my real project is quite big and I have nice MSVC++
workspaces to build libraries of it with and without Boost.Python. I
hesitate trying to put the DLL build using Boost.Python into Jam.... then
I'd have yet another way of building my project. Sure, I'll probably have to
do just that sometime later when working on other platforms anyway, and I am
not complaining too much about it seeing how much great stuff I get for free
with Boost.Python. But, it would sure be nice if I can do without this, at
least for the time being.
So I'm stuck trying to build a MSVC++ Pythonized DLL of my project that
works 100% properly.
1.) Is it just a bad idea to use the MSVC++ IDE to build Boost.Python based
packages? I see that
the MSVC++ workspace to build Boost is no longer provided. Was that just
too much of a pain to
keep up with, or are there some intrinsic problems?
2.) If there are none, what CRT library do I need to link to? I have not
stumbled onto the proper
combination. How and what does Jam choose for the CRT library used when
Can I change it, as I guess it must always match the one used in
building any projects using it?
3.) It looks to be too much work to try and build Boost.Python in the MSVC++
IDE, although that would
almost certainly fix my problems (i.e. build my project & Boost.Python
simultaneously into one DLL)
A task much much worse that figuring out how to build my whole project
If anyone cares for it, I can send URLs that talk about this MSVC++ CRT
problem when building DLLs. I have tried building things as both Debug and
Release versions in MSVC++ to make sure I wasn't mixing up librarys, neither
worked. Any ideas would be appreciated.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk