Bug #44272 Driver::connect, access violation with mixed Release and Debug code
Submitted: 14 Apr 2009 17:45 Modified: 11 Nov 2009 10:17
Reporter: Nick Lloyd Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / C++ Severity:S4 (Feature request)
Version:1.0.4beta OS:Windows (Visual Studio 2009)
Assigned to: Assigned Account CPU Architecture:Any

[14 Apr 2009 17:45] Nick Lloyd
Description:
Calling a C++ Connector DLL built in Release mode from a users application
built in Debug mode makes Driver::connect() fail with an access violation.

The cause is that std::string in Debug mode is incompatible with std::string
in Release (one is 28 bytes in size, the other is 32 bytes in size). String pointers get messed up and the result is garbage or an access violation.

How to repeat:
Call a release Connector/C++ DLL from a a debug mode application

Suggested fix:
Users must NOT mix Release Connector C++ DLL with Debug applications (and vice versa) as the marshalling/integrity of (some) C++ objects between Debug and Release is clearly not guaranteed. I notice that the distribution includes a
RelWithDebInfo which will assist users wishing to debug.

It would be nice if the Connector C++ interfaces could be be designed robust so only one C++ Connector configuration will work with both Debug and Release user applications. But I understand this may not be feasible at the current time.

As time goes on I am convinced the standard template library objects are anything but standard.
[14 Apr 2009 17:55] Andrey Hristov
Only C is robust enough but this is not Connector/C . I have seen problems on Linux when the client was compiled with STLPort and the connector with GNU's C++ library. Again, std::string .
[15 Apr 2009 6:45] Tonci Grgin
Hi Nick and thanks for your report. I must concur with Andrey here but we'll see what other devs have to say on this.
[15 Apr 2009 8:01] Tonci Grgin
Nick, we've discussed it and here's our ruling. Your feature request is valid but hardly doable, especially at this stage of development. Thus I'm setting this to S4 and "To be fixed later". We have also found quotes showing this is not always supported in various combinations (for example http://social.microsoft.com/Forums/en-US/vcgeneral/thread/40971627-3fe3-42be-ba2b-d2e5bdca...) which we should take in consideration once the decision to improve this behavior is reached.

Thanks for your interest in MySQL.
[15 Apr 2009 8:02] Tonci Grgin
More relevant reference from VC++ team member: http://social.microsoft.com/Forums/en-US/vcgeneral/thread/efef799e-5d88-4a95-be39-4cd674be...
[13 Mar 2014 13:37] Omer Barnir
This bug is not scheduled to be fixed at this time.
[17 Oct 2022 22:25] Luis Silva
Posted by developer:
 
Currently we provide both Release and Debug binaries.