I am using MSVS 9 (VS 2008). My application as well as shared library(dll)(I am using to link with my application) is also of c++ environment. Now observe the below cases:
when the shared library/dll is built in Debug mode and my application is also built in Debug mode Result: Application executed successfully
when the shared library/dll is built in Release mode and my application is also built in Release mode Result: Application executed successfully
when the shared library/dll is built in Release mode and my application is also built in Debug mode Result: Application is getting crashed without loading any symbols from call stack.
call stack:
ntdll.dll!76e94684()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]ntdll.dll!76e7d55f()
ntdll.dll!76e5fa18()
ntdll.dll!76e2b3c8()
This problem is seen when I am trying to use the following SetName() and GetName() definitions in my application.
using namespace std;
void main()
{
Schema * schemaExp = new Schema();
schemaExp -> SetName("ExpSchema");
string srctable;
srctable=schemaExp->GetName();
cout <<"\nConnection EXPORT using the target table:" << srctable.c_str() << endl;
delete schemaExp;
}
Schema Class Definition:
using namespace std;
class Schema
{
public:
TELAPI_EXPORT void SetName(char *name);
TELAPI_EXPORT string GetName();
protected:
string tableName;
};
void Schema::SetName(char *name)
{
string str(name);
tableName = str;
}
string Schema::GetName()
{
return tableName;
}
Note: The above one is just a part from my application and my application is getting crash only in the #3 and working fine with #1 and #2 cases above
Please help me in fixing this problem. Any kind of help is greatly appreciated.
Thanks in advance.