I'm trying to export method from DLL which returns STL object. I'm using MFC.
For example in my dll I have:
std::map<CString, CString> __declspec(dllexport) __stdcall MyMethod(CString str1, CString str2, bool boolValue)
{
//here create map
std::map<CString, CString> map;
map.insert(std::make_pair("key1", "value1"));
return map;
}
And I'm trying to load dll file in my exe app:
//Here I'm sure dll is loaded in proper way
HINSTANCE dllHandle = dllHandle = LoadLibrary("mydll.dll");
//Then I'm getting pointer to exported method:
typedef std::map<CString, CString>(__stdcall *DllMyMethod)(CString str1, CString str2, bool boolValue);
//This is my class member:
DllMyMethod callMyMethod;
//And getting this function pointer
callMyMethod = (DllMyMethod)GetProcAddress(dllHandle, "MyMethod");
And unfortunately, callMyMethod
pointer is empty. Exe app and dll app is created with Visual Studio 2013 with this same settings.
How can I export this method in proper way?