[C++-sig] Memory allocation problem

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[C++-sig] Memory allocation problem

Nariman Habili

I'm developing a Boost Python application that links with a number of other
libraries. I'm using Python version 2.3, and bjam version 3.1.10. All of the
libraries have been compiled with the /MDd option using the MVS IDE,
compiler vc7. The first issue I had was a linking problem, with error
messages such as:

LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in
MSVCRTD.lib(MSVCR70D.dll) : error LNK2005: __open already defined in

I was able to eliminate the error messages by executing the linking command
manually with the option /NODEFAULTLIB:LIBCMTD.lib.

I have come across another problem which I haven't been able to resolve. A
struct, called ImageParams, is defined in a header file of library
kernel.lib. Within my boost python application std::cout <<
sizeof(ImageParams) gives 240 bytes, while in kernel.lib,
sizeof(ImageParams) is 248 bytes. Because of the discrepancy in the amount
of memory allocated, I'm running into all sorts of trouble, and I can't work
out why the allocated memories should be different. The only thing I can
think of is that my boost python application is inlining the struct, and
because of some option setting, the struct is padded differently to achieve
word or paragraph alignment.

I've looked at the command that boost python executes to create the .obj
files, and I've modified the compiler options for kernel.lib in the MVS IDE
to match those executed by boost python, to no avail, however I might be
missing something. I would be very grateful if anyone can help me to solve
this problem, thanks.


C++-sig mailing list
[hidden email]