Nevertheless, you definitely have some header files translated. So the problem exists somewhere in one of these files or in the project settings.User seem to have expressed converting from procedural code to object code. Therefor I am assuming it does already work but user wishes to abstract to objects.
Without sample code and feedback about the errors you receive, it is hard to conclude anything. Maybe try to prepare some example posts and attach the content of the errors you receive to it.To that I say +1 because right now it is a theoretical question and from what I've understood atm I would probably solve it another way (but at the same time I am unfamiliar with the API).
Nevertheless, you definitely have some header files translated. So the problem exists somewhere in one of these files or in the project settings.User seem to have expressed converting from procedural code to object code. Therefor I am assuming it does already work but user wishes to abstract to objects.
There is a clear difference between a callback routine for a procedure (which the library expects) vs procedure of object (which requires an additional hidden parameter). cdbc's answer solves that (by using a class procedure).
Follow-up question: being a static class means that it's allocating memory on the heap. Do I have to do anything to manage this, or is it sufficient that it's a member of an object which, itself, is a member of a dynamic array to assure that somehow its instance will be destroyed and the memory returned to the heap?
Follow-up question: being a static class means that it's allocating memory on the heap. Do I have to do anything to manage this, or is it sufficient that it's a member of an object which, itself, is a member of a dynamic array to assure that somehow its instance will be destroyed and the memory returned to the heap?1) The whole class isn't 'static', just the 1 method. In fact, it being a static class procedure/function means, you have NO access to the class to which it belongs, nor the class' innards...
I deliberately tried to keep the question general because I wanted to focus on what I was trying to do and where the problem existed.Sure but, you have to keep in mind that probably no one here is familiar with the API. If there is someone who is then you're extremely lucky (the chance that someone else is using the exact same hardware such as yours and uses pascal can be a bit problematic).
I trusted that, absent an answer like that I received from cdbc, we'd get deeper into specifics, but I didn't think the distraction of specifics was necessary at first. Apparently cdbc agreed.cdbc offered an answer you are able to work with. It does not necessarily means it is the right solution for your use case. Note that static class procedures are actually static and thus the same for every derived object (and that might perhaps not fit your use case)
Still, many thanks!You're most welcome. Would be nice to know if in the end cdbc's answer suited your use case.
The callback should have an identifier like a handle or device number supplied to your code so you can use a single callback for all devices.Depends on how TS implements his solution. Like VisualLab I would probably opt for another approach exactly because of what you mentioned
The trick is to use the identifier to determine the device.
(Do I need to mark this problem as solved? If so, how do I do that?)Yes, that would be nice... You open the first post in this thread and modify that header, then click on the [Save] button, easy peasy :D
is there no way to find the address of a method of an object?
I asked for both an answer to this question (yes, it's a bit abstract), as well as for a work-around. I got the latter. I'm satisfied.Thank you for reporting back dr.John.