Click here to Skip to main content
15,900,818 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNeed for Multipart/mixed content type Pin
monsieur_jj29-Aug-07 14:50
monsieur_jj29-Aug-07 14:50 
AnswerRe: Need for Multipart/mixed content type Pin
monsieur_jj29-Aug-07 17:19
monsieur_jj29-Aug-07 17:19 
QuestionactiveX wrapper files - how to generate? Pin
charlieg29-Aug-07 13:50
charlieg29-Aug-07 13:50 
AnswerRe: activeX wrapper files - how to generate? Pin
Mark Salsbery29-Aug-07 14:08
Mark Salsbery29-Aug-07 14:08 
QuestionCControlBar derived class example? Pin
Jerry Evans29-Aug-07 8:55
Jerry Evans29-Aug-07 8:55 
AnswerRe: CControlBar derived class example? Pin
bob1697229-Aug-07 12:10
bob1697229-Aug-07 12:10 
QuestionUsing CFile or CStdioFile with CEditView - how to copy the entire text Pin
Vaclav_29-Aug-07 8:21
Vaclav_29-Aug-07 8:21 
AnswerRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Russell'29-Aug-07 9:09
Russell'29-Aug-07 9:09 
GeneralRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Vaclav_29-Aug-07 10:28
Vaclav_29-Aug-07 10:28 
AnswerRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Dennis Gourjii29-Aug-07 9:42
Dennis Gourjii29-Aug-07 9:42 
GeneralRe: Using CFile or CStdioFile with CEditView - how to copy the entire text Pin
Vaclav_29-Aug-07 10:26
Vaclav_29-Aug-07 10:26 
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 

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.