Reputation: 59
I have a little problem and I dont know how to solve it (sadly).
I want to compile a sample project of the Awesomium 1.7RC2 SDK, it works fine with vs10, but with vs11 I do get some Errors.
These are the errors:
http://pastebin.com/6RdUffve
They are caused by these lines of code:
method_dispatcher_.Bind(app_object,
WSLit("SayHello"),
&Application::OnSayHello);
method_dispatcher_.Bind(app_object,
WSLit("Exit"),
&Application::OnExit);
method_dispatcher_.BindWithRetval(app_object,
WSLit("GetSecretMessage"),
&Application::OnGetSecretMessage);
The code of the dispatcher class:
header: http://pastebin.com/ktTEuQ4T
source: http://pastebin.com/FTDHQzJ9
I hope someone can help me :)
Upvotes: 2
Views: 544
Reputation: 5456
This seems to be caused by a bug in VS2012, where std::function does not implicitly convert member function pointers to function pointers. This example, which should work according to Bjarne Stroustroups C++11 FAQ, throws the same error in my VS2012:
struct X {
int foo(int);
};
function<int (X*, int)> f;
f = &X::foo; // pointer to member
X x;
int v = f(&x, 5); // call X::foo() for x with 5
You can work around this by creating static functions like
void StaticOnSayHello(Application* app, Awesomium::WebView* caller, const Awesomium::JSArray &args) {
app->OnSayHello(caller, args);
}
etc, and giving these as the third argument to method_dispatcher::Bind.
Upvotes: 1