You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to say I understand that this is my problem, not yours - I'm just hoping you have time to give me a pointer. This is sort of a follow-up to Question: Identifying Caller in Callback #25. Basically, I have 1-N request types which I might be using and hope to re-use a function that actually sends the data. The callback needs to know the calling function's context in order to meet my needs.
The plan was to pass a variable to the callback, and thereby identify which report it is that's being handled. The only way I am able to do this is by &reference. When I do that, the original variable goes out of scope from the caller. I can prove that by adding a delay() in my calling function so that it's still "alive" when the callback fires.
I understand why, but since you have this functionality there I'm relatively certain what I need is possible and I'm just too dense to get it. Any assistance would be appreciated.
- Lee
The text was updated successfully, but these errors were encountered:
Well, I got around this by using a pointer function to the callbacks and then having the callbacks in turn call the handler. Seems inelegant but it is working.
Bob,
I need to say I understand that this is my problem, not yours - I'm just hoping you have time to give me a pointer. This is sort of a follow-up to Question: Identifying Caller in Callback #25. Basically, I have 1-N request types which I might be using and hope to re-use a function that actually sends the data. The callback needs to know the calling function's context in order to meet my needs.
The plan was to pass a variable to the callback, and thereby identify which report it is that's being handled. The only way I am able to do this is by
&reference
. When I do that, the original variable goes out of scope from the caller. I can prove that by adding adelay()
in my calling function so that it's still "alive" when the callback fires.Here's my header:
And the code:
The results are (predictably) inconsistent:
I understand why, but since you have this functionality there I'm relatively certain what I need is possible and I'm just too dense to get it. Any assistance would be appreciated.
- Lee
The text was updated successfully, but these errors were encountered: