Roman Shchugarev wrote:
> Well my UTF-8 convertion worked, but now I am facing another difficulty, 
> this might not be libpqxx related, but I am not sure
> 
> At this point all the convertions work fine, (Using MFC 7.1 libraries as 
> DLLs)
> When I tried to switch to using static MFC libraries I got my self in a 
> new error, the error occures at runtime and says that HEAP memory is 
> corrupted, as far as I understood the problem is in fact that during my 
> home-made convertion using MultiByteToWideChar function I am passing 
> memory buffer from pgxx DLLs into an MFC  portion of code and at some 
> point(not sure which) I recieve HEAP error and programm stops in _CRTIMP 
> int __cdecl _CrtIsValidHeapPointer(
>         const void * pUserData) ....
> I am a bit confused by the fact that error occures only executing 
> statically linked MFC ....

Well, you could try putting in a check to see if there is still a NUL at 
the end of the c_str() buffer. That should rule out buffer overruns.

I'm a bit concerned about const-casting the c_str() return value BTW. 
It'll probably work, since you use fresh strings, but there are 
absolutely no guarantees here. Especially the VC++ 7.1 STL does weird 
stuff with strings -- strings shorter than 16 bytes are stored in the 
string object itself, etcetera. There is also no rule that says that the 
return value of c_str() points to the string's actual buffer!

Cheers,
Bart
_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to