Thank you for your answer.
I changed 'string' to 'IntPtr'
[DllImport("somedll.dll", EntryPoint="?getValueAsString@myclass@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ", CallingConvention=CallingConvention::ThisCall)]
static IntPtr getValueAsString(myclassUnman*);
IntPtr getValueAsString(){
return myclassUnman::getValueAsString(tv);
}
it builds without error but when i call it from c#, it gives an exception at the following line:
return myclassUnman::getValueAsString(tv);
Exception is :
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Do you have any idea about this problem?