Hi all,
I am working on vs2005 (vc++8).
I have created one dll in vs2005(vc++8), in that we have one function which returns "std::string" .

when i load this dll in another vs2005(vc++8) application and call the function which returns "std::string",
we get following error:

Windows has triggered a breakpoint in vstestdll.exe.

This may be due to a corruption of the heap, and indicates a bug in vstestdll.exe or any of the DLLs it has loaded.

The output window may have more diagnostic information


For more detail code is as follows:

dll function :



	 std::string getDH1(int clo)

	 {

		

		 return std::string("abcdefghijklmnopqr");

	 }





	.exe code:



	#define TEST2_API __declspec(dllimport);

	TEST2_API  std::string getDH1(int clo);





	int _tmain(int argc, _TCHAR* argv[])

	{

		

		string sam =getDH1(1);

		

		return 0;

	}
Member Avatar for jencas

What happens if you rewrite your dll function:

void getDH1(int clo, std::string & str);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.