Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: change style of Tab Control in property sheet Pin
Mark Salsbery11-Dec-06 7:43
Mark Salsbery11-Dec-06 7:43 
QuestionData within a Text File Pin
Programm3r11-Dec-06 1:48
Programm3r11-Dec-06 1:48 
AnswerRe: Data within a Text File Pin
Cedric Moonen11-Dec-06 1:52
Cedric Moonen11-Dec-06 1:52 
QuestionRe: Data within a Text File Pin
Programm3r11-Dec-06 1:56
Programm3r11-Dec-06 1:56 
AnswerRe: Data within a Text File Pin
Cedric Moonen11-Dec-06 2:00
Cedric Moonen11-Dec-06 2:00 
GeneralRe: Data within a Text File Pin
Programm3r11-Dec-06 2:15
Programm3r11-Dec-06 2:15 
AnswerRe: Data within a Text File Pin
David Crow11-Dec-06 3:10
David Crow11-Dec-06 3:10 
Questionissue: "passing" a std::map from an library to another Pin
ledzzep11-Dec-06 1:18
ledzzep11-Dec-06 1:18 
Hello

on visual c++ 6

my pb is:
when I create a std::map in an exe and pass it to a object's method in a DLL, I can't access to the elements of the map (it crashs after the first access).
You can try this minimal code illustrating that.

the code: a main.cpp file: the "application".
dll.h and dll.cpp : the dll with the object's method:
main.cpp___________________________
#pragma warning( disable: 4786 )<br />
<br />
#include <map><br />
#include <iostream><br />
#include <string><br />
#include "dll.h"<br />
<br />
int main ()<br />
{<br />
	std::map<const std::string, std::string>  l_map;<br />
	std::map<const std::string, std::string>::iterator it;<br />
	int i;<br />
<br />
	l_map["1"] = "2";<br />
	l_map["3"] = "4";<br />
	l_map["5"] = "6";<br />
<br />
	for (it = l_map.begin(); it != l_map.end(); it++)<br />
	{<br />
		std::cout << (*it).first << ": " << (*it).second << "\n";<br />
	}<br />
<br />
	CDll obj;<br />
	obj.f(l_map);<br />
<br />
	std::cin >> i;<br />
	return 0;<br />
}

dll.h________________________________________
#pragma warning( disable: 4786 )<br />
<br />
#include <map><br />
#include <iostream><br />
#include <string><br />
<br />
#ifdef DLL_EXPORTS<br />
#define DLL_API __declspec(dllexport)<br />
#else<br />
#define DLL_API __declspec(dllimport)<br />
#endif<br />
<br />
class DLL_API CDll<br />
{<br />
public:<br />
	void f(std::map<const std::string, std::string>& p_map);<br />
};<br />

dll.cpp________________________
<br />
#include "dll.h"<br />
<br />
void CDll::f(std::map<const std::string, std::string>& p_map)<br />
{<br />
	std::map<const std::string, std::string>::iterator it;<br />
<br />
	for (it = p_map.begin(); it != p_map.end(); it++)<br />
	{<br />
		std::cout << "DLL: " <<(*it).first << ": " << (*it).second << "\n";<br />
	}<br />
}<br />


Thank you in advance for your help.

Nico
AnswerRe: issue: "passing" a std::map from an library to another Pin
Cedric Moonen11-Dec-06 1:46
Cedric Moonen11-Dec-06 1:46 
AnswerRe: issue: "passing" a std::map from an library to another Pin
prasad_som11-Dec-06 2:26
prasad_som11-Dec-06 2:26 
AnswerRe: issue: "passing" a std::map from an library to another Pin
James R. Twine11-Dec-06 3:56
James R. Twine11-Dec-06 3:56 
AnswerRe: issue: "passing" a std::map from an library to another Pin
Nemanja Trifunovic11-Dec-06 4:07
Nemanja Trifunovic11-Dec-06 4:07 
GeneralRe: issue: "passing" a std::map from an library to another Pin
Zac Howland11-Dec-06 4:11
Zac Howland11-Dec-06 4:11 
GeneralRe: issue: "passing" a std::map from an library to another Pin
Nemanja Trifunovic11-Dec-06 10:04
Nemanja Trifunovic11-Dec-06 10:04 
GeneralRe: issue: "passing" a std::map from an library to another Pin
Zac Howland11-Dec-06 10:10
Zac Howland11-Dec-06 10:10 
GeneralRe: issue: "passing" a std::map from an library to another Pin
Nemanja Trifunovic11-Dec-06 10:38
Nemanja Trifunovic11-Dec-06 10:38 
QuestionWhere is the class wizard in VS2005 Pin
eli1502197911-Dec-06 1:01
eli1502197911-Dec-06 1:01 
AnswerRe: Where is the class wizard in VS2005 Pin
bob1697211-Dec-06 1:50
bob1697211-Dec-06 1:50 
AnswerRe: Where is the class wizard in VS2005 Pin
prasad_som11-Dec-06 4:59
prasad_som11-Dec-06 4:59 
AnswerRe: Where is the class wizard in VS2005 Pin
PJ Arends11-Dec-06 5:44
professionalPJ Arends11-Dec-06 5:44 
AnswerRe: Where is the class wizard in VS2005 Pin
rgbalpha11-Dec-06 17:22
rgbalpha11-Dec-06 17:22 
QuestionSystem services Pin
Waldermort11-Dec-06 0:24
Waldermort11-Dec-06 0:24 
AnswerRe: System services Pin
Mark Salsbery11-Dec-06 9:51
Mark Salsbery11-Dec-06 9:51 
QuestionHow to create Outlook .MSG file???? Pin
nagamohan_p11-Dec-06 0:01
nagamohan_p11-Dec-06 0:01 
QuestionRestricting File Access Pin
Marko B.L.10-Dec-06 23:26
Marko B.L.10-Dec-06 23:26 

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.