question

brendan avatar image
brendan asked

Using callbacks in C++

Brendan Vanous
started a topic on Mon, 23 March 2015 at 1:06 PM

A developer wrote in with this question:

I'm calling LoginWithFacebook, but I'm not sure how to use the LoginWithFacebookCallback parameter. How do I give my callback function to that parameter in C++?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Mon, 23 March 2015 at 1:06 PM

In our Windows (C++) SDK, you'll see LoginWithFacebook defined like so in the PlayFabClientAPI class:

typedef void(*LoginWithFacebookCallback)(ClientModels::LoginResult& result, void* userData)

In your own code, you would have a callback defined something like this:

void LoginWithFacebookDoneCallback (ClientModels::LoginResult& result, void* UserData);

Then, when you call the LoginWithFacebook API method from your code, you would simply pass in your LoginWithFacebookDoneCallback function for the Callback parameter, like so (assuming "request" is your LoginWithFacebookRequest object, though I've left off the error callback or UserData for this example):

LoginWithFacebook (request, LoginWithFacebookDoneCallback);


1 Comment
Brendan Vanous said on Mon, 23 March 2015 at 1:06 PM

In our Windows (C++) SDK, you'll see LoginWithFacebook defined like so in the PlayFabClientAPI class:

typedef void(*LoginWithFacebookCallback)(ClientModels::LoginResult& result, void* userData)

In your own code, you would have a callback defined something like this:

void LoginWithFacebookDoneCallback (ClientModels::LoginResult& result, void* UserData);

Then, when you call the LoginWithFacebook API method from your code, you would simply pass in your LoginWithFacebookDoneCallback function for the Callback parameter, like so (assuming "request" is your LoginWithFacebookRequest object, though I've left off the error callback or UserData for this example):

LoginWithFacebook (request, LoginWithFacebookDoneCallback);

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.