R
RThaden
Hi together,
I am a bit clueless about the following problem:
In the following code excerpt
std::string getStr()
{
std::string bla="asdfsa";
return bla;
}
void func1()
{
{
std::string str1=getStr();
}
return;
}
str1 is destroyed when the scope inside func1() is left.
Works fine.
But, if getStr() is inside a DLL and is called from func1() in a main
program, this does not work.
At least, I experience that in my code.
Actually, the getStr() is a member function of a class in the DLL which
is exported.
Are they not sharing the same memspace?
Am I missing something?
See callstack below
NTDLL! 7c911230()
NTDLL! 7c97cd80()
NTDLL! 7c970af8()
KERNEL32! 7c85e9cf()
_CrtIsValidHeapPointer(const void * 0x009d33d8) line 1697
_free_dbg_lk(void * 0x009d33d8, int 0x00000001) line 1044 + 9 bytes
_free_dbg(void * 0x009d33d8, int 0x00000001) line 1001 + 13 bytes
free(void * 0x009d33d8) line 956 + 11 bytes
operator delete(void * 0x009d33d8) line 7 + 10 bytes
std::allocator<char>::deallocate(void * 0x009d33d8, unsigned int
0x00000021) line 64 + 16 bytes
Thanks in advance,
I am a bit clueless about the following problem:
In the following code excerpt
std::string getStr()
{
std::string bla="asdfsa";
return bla;
}
void func1()
{
{
std::string str1=getStr();
}
return;
}
str1 is destroyed when the scope inside func1() is left.
Works fine.
But, if getStr() is inside a DLL and is called from func1() in a main
program, this does not work.
At least, I experience that in my code.
Actually, the getStr() is a member function of a class in the DLL which
is exported.
Are they not sharing the same memspace?
Am I missing something?
See callstack below
NTDLL! 7c911230()
NTDLL! 7c97cd80()
NTDLL! 7c970af8()
KERNEL32! 7c85e9cf()
_CrtIsValidHeapPointer(const void * 0x009d33d8) line 1697
_free_dbg_lk(void * 0x009d33d8, int 0x00000001) line 1044 + 9 bytes
_free_dbg(void * 0x009d33d8, int 0x00000001) line 1001 + 13 bytes
free(void * 0x009d33d8) line 956 + 11 bytes
operator delete(void * 0x009d33d8) line 7 + 10 bytes
std::allocator<char>::deallocate(void * 0x009d33d8, unsigned int
0x00000021) line 64 + 16 bytes
std::basic_string said:::_Tidy(unsigned char 0x01) line 592
std::basic_string said:::~basic_string<char,std::char_traits<char>,std::allocator<char> >() line 59 + 17 bytes
Thanks in advance,