I guess I could add for clarity:
The function in the dll looks like this -
MyObj* MyClass::funct1(std::string str1, std::string str2, long var1, long var2, std::string str3)
{
MessageBox(0, s2ws(str1).c_str(), L"String 1 Value", 1);
MessageBox(0, s2ws( str2).c_str(), L"String 2 Value", 1);
MessageBox(0, s2ws(str3).c_str(), L"String 3 Value", 1);
// Code to return the object is here.
}
where function s2ws is defined as (found online) -
std::wstring s2ws(const std::string& s)
{
int len;
int slength = -1;
len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
std::wstring r(buf);
delete[] buf;
return r;
};
This results in mangled names being displayed for the string values even though they are correctly passed into the function. I was wondering if this was due to the differences in the character sets being used between the static and dynamic libraries. The next thing I wanted to try was to convert the strings to wide string before passing them into the dll.
So on the static side I took the strings and passed them to the s2ws function before passing them in and checked both versions there. They were correct. So next I needed a new function in the dll to take wstring values. It is pretty much the same as above -
MyObj* MyClass::funct1(std::wstring str1, std::wstring str2, long var1, long var2, std::wstring str3)
{
MessageBox(0, str1.c_str(), L"String 1 Value", 1);
MessageBox(0, str2.c_str(), L"String 2 Value", 1);
MessageBox(0, str3.c_str(), L"String 3 Value", 1);
// Code to return the object is here.
}
That gets me back to the scenario I described first. After rebuilding everything, I am getting the LNK2019 error.
Thanks...