I'm very new to using std and I'm currently trying to call into a function that takes an std::function as a param. Something similar to below:
In the .h file in one lib:
typedef bool t (/*Params*/);
void __stdcall Foo(std::function<t> &function) {m_function = function;}
std::function<t> m_function;
I imported the lib and tried to use Foo in another cpp file:
bool Implementation (/*Params*/)
{
// Implementation
}
void Bar()
{
Foo(std::function<t> (Implementation));
}
I'm getting a linker error (LNK2019) when I compile for x86 (but not x64) because of the calling convention:
Unresolved External Symbol __stdcall Foo (class std::tr1::function<bool __cdecl(/*Params*/) const&)
From this I gathered that I need to mark "t" and Implementation as __stdcall but doing so causes other compile failures. I should also note the code compiled correctly when it was being built in the same lib. Is there a way to associate a calling convention to an std::function?