Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As I noted in the comments a couple of hours ago, you have several ways to resolve this issue:</p> <p>1) Use a higher-level library than the one you are currently using where you could preferably use signals and slots then as ideal in a Qt application.</p> <p>2) You could try passing your class instance as raw the data. This would ensure that the callback will have an object to work with. Of course, that would need reinterpret_cast'ing from the void* data to the desired type as usual.</p> <ul> <li>Establish property mutator and accessor methods to set and get the members</li> <li>Declare the callback function as friend, but that is usually discouraged.</li> <li>Just call a slot or simple method from the callback to do the job for you.</li> <li>Use a functor for doing the job</li> <li>etc...</li> </ul> <p>3) You could also implement the necessary logic yourself inside your project if is not too complex. That way, you could even reduce the dependency.</p> <p>It is difficult to say which approach would suit you the best as it depends a lot on the use cases and more context than we have here.</p> <p>I would probably go for either member data accessor and mutator methods, or a dedicated function in your class which does the real job, and the free callback function would just cast the void* to your type, and call the method on that instance.</p> <p>This would also ensure that you can use the callback with non-c++ code later as you would need to replace the internal implementation of it, only. This would also help later with getting rid of the external C callback which calls the class method.</p> <p>I think you should check out the following url where there is a relatively detailed sample code, where there is also a callback for similar issues with this low-level library.</p> <p><a href="https://codereview.stackexchange.com/questions/8840/ni-daqmx-c-wrapper-code-for-analog-data-acquisition-using-national-instrument">NI-DAQmx C++ wrapper code</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload