Advertisement Jump to content
Sign in to follow this  

(MFC) CString crash crossing DLL boundary

This topic is 4505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a strange problem with CStrings. I'm designing an SDK for my application. At one point the SDK assigns a string literal to an empty CString in the main application via a pointer (so the DLL is accessing a CString in a different module). Since the CString is previously empty, I'm assuming it reallocates. However it crashes in Release mode (but not debug). I've identified the problem as CString assignment with messagebox popups :P All structs/definitions are identical as are calling conventions and linker settings in both compiles. Both are set to "Use MFC in a shared DLL", and both link to "Multithreaded DLL" CRT library (obviously Debug Multithreaded DLL for the working debug build though). I've heard about problems with heap allocations over DLL boundries but my linker settings are the same and I can't see the problem. I can and probably should abstract out CStrings for portability, but can anyone shed any light on the issue?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!