View Single Post

   
  #1 (permalink)  
Old 01-04-2008, 11:28 PM
m v
 
Posts: n/a
Default Apparently two different std:string classes being used by the same program

Thanks for reading.

I am getting cores because a std::string allocated in one module, and
then returned to another module by a method call, is apparently not
compatible with the std::string used by the other module. The first
module, which news the string, can manipulate it fine. It returns the
pointer on a call. The second module gets bad values for c_str() and
len(). It is apparently expecting a different size or alignement of
the member data (e.g. _Ptr, _Len). I can see this by looking at the
string objects data in xldb and comparing it to the data in objects
created by the second module (which it can use fine). The values
returned by c_str() and len() also corespond with the offset shift. In
the first module the _Ptr is at offset 1 (i.e. the first member,
"_String_val...", took up one 1 byte). In the second _Ptr is at
offset 4.

What could be causing this?

I tried explicitly using std::string in both modules.

I suspect some static or dynamic link thing.
I have some older builds of the program, with essentially the same
code, that don't have this problem.


I'm desperate and open to any suggestions.

Thanks,
Micheal
Reply With Quote