Click here to Skip to main content
15,891,793 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Mark Salsbery29-Aug-07 9:45
Mark Salsbery29-Aug-07 9:45 
AnswerRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Vaclav_29-Aug-07 10:20
Vaclav_29-Aug-07 10:20 
GeneralRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Mark Salsbery29-Aug-07 12:11
Mark Salsbery29-Aug-07 12:11 
QuestionData Sychronization Pin
Anthony988729-Aug-07 7:53
Anthony988729-Aug-07 7:53 
QuestionCallback functions???? Pin
pblais29-Aug-07 5:35
pblais29-Aug-07 5:35 
AnswerRe: Callback functions???? Pin
Russell'29-Aug-07 5:42
Russell'29-Aug-07 5:42 
GeneralRe: Callback functions???? Pin
pblais29-Aug-07 12:16
pblais29-Aug-07 12:16 
QuestionAccess violation when using STL map in DLL (VS7) Pin
Danny77uk29-Aug-07 5:10
Danny77uk29-Aug-07 5:10 
vHi. I'm working on an MFC project in a company and we're stuck with Visual Studio 7.0 (2002/.Net) for the time being. I added an STL::map to a dll to hold some strings. The code compiles fine but falls over with an access violation whenever I try to do anything with the map (add items, call find() etc). It's like the container is corrupted somehow.

I've googled the problem and I've read a few other articles (eg. http://support.microsoft.com/kb/q168958/) and I think everything is set up correctly. Here's my code:

<br />
header of DLL:<br />
<br />
#pragma once<br />
<br />
namespace RegUtils<br />
{<br />
CString	getRegCachedValue(const CString& p_strID);<br />
<br />
..<br />
<br />
//lots of other exported functions<br />
}<br />
<br />
CPP of DLL:<br />
<br />
typedef std::map<CString, CString> RegKeyMap;<br />
typedef RegKeyMap::iterator RegKeyMapIter;<br />
RegKeyMap gRegKeyMap;<br />
<br />
CString RegUtils::getRegCachedValue(const CString& p_strID)<br />
{<br />
	CString strValue = _T("");<br />
	<br />
	RegKeyMapIter iter = gRegKeyMap.find(p_strID); // lookup item<br />
	if (gRegKeyMap.end() != iter) {<br />
		strValue = iter->second;<br />
	}<br />
<br />
	return strValue;<br />
}<br />


As soon as the code gets to the find() method, it falls over. Ditto for any other operation on the map. Please help this is driving us nuts and I feel I've tried everything.

It's been suggested we switch to MFC maps as they apparently don't have this problem but that would be a LOT of work.

I'm using the 'Multi-threaded Debug DLL (/MDd)' runtime lib to build the DLL. I've read about problems associated with copying STL objects back and forth over DLL boundaries but I'm not doing that here - the map and this function is private to the DLL (it is not exported) and is used only internally. The code is being called by other DLLs (also built using /MDd).

Please help! Frown | :(
AnswerRe: Access violation when using STL map in DLL (VS7) Pin
led mike29-Aug-07 7:18
led mike29-Aug-07 7:18 
AnswerRe: Access violation when using STL map in DLL (VS7) Pin
Cedric Moonen29-Aug-07 7:20
Cedric Moonen29-Aug-07 7:20 
GeneralRe: Access violation when using STL map in DLL (VS7) Pin
Stephen Hewitt29-Aug-07 16:25
Stephen Hewitt29-Aug-07 16:25 
AnswerRe: Access violation when using STL map in DLL (VS7) Pin
George L. Jackson29-Aug-07 14:26
George L. Jackson29-Aug-07 14:26 
QuestionTCP/IP Sockets or Something New Pin
Andy20229-Aug-07 5:06
Andy20229-Aug-07 5:06 
AnswerRe: TCP/IP Sockets or Something New Pin
led mike29-Aug-07 7:13
led mike29-Aug-07 7:13 
AnswerRe: TCP/IP Sockets or Something New Pin
Mark Salsbery29-Aug-07 7:24
Mark Salsbery29-Aug-07 7:24 
QuestionGDI+ DrawImage Pin
TheShihan29-Aug-07 4:27
TheShihan29-Aug-07 4:27 
AnswerRe: GDI+ DrawImage Pin
James R. Twine29-Aug-07 7:01
James R. Twine29-Aug-07 7:01 
AnswerRe: GDI+ DrawImage Pin
Hamid_RT29-Aug-07 7:18
Hamid_RT29-Aug-07 7:18 
GeneralRe: GDI+ DrawImage Pin
TheShihan29-Aug-07 20:31
TheShihan29-Aug-07 20:31 
GeneralRe: GDI+ DrawImage Pin
Hamid_RT31-Aug-07 2:04
Hamid_RT31-Aug-07 2:04 
QuestionIE7 and Explorer Folders Pin
convivial.developer29-Aug-07 4:10
convivial.developer29-Aug-07 4:10 
AnswerRe: IE7 and Explorer Folders Pin
Perspx29-Aug-07 6:32
Perspx29-Aug-07 6:32 
GeneralRe: IE7 and Explorer Folders Pin
convivial.developer29-Aug-07 7:22
convivial.developer29-Aug-07 7:22 
GeneralRe: IE7 and Explorer Folders Pin
Perspx29-Aug-07 8:21
Perspx29-Aug-07 8:21 
QuestionIs it possible to add check to for each tree items instead of all? Pin
eagle5129-Aug-07 4:10
eagle5129-Aug-07 4:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.