You don't show where
is initialized. Are you sure that pointer is valid?
And one important thing I see is the type of the callback parameter. It is supposed to be a function pointer
but in your code it is an int
. This will lead to problems if you are running this code on a 64bits platform since int
is 32 bits and pointer 64 bits... In that case, ask your provider a 64 bits compatible dll.
I was curious and searched for your SDK manual. I found this: http://support.elmark.com.pl/advantech/pdf/DVP-7010Bman.pdf
The callback prototype is different from yours: it contains 5 arguments instead of 6. But you probably have a newer version of the SDK (?).
Anyway this can't be the problem since the function is just supposed to assign a pointer (it would crash at a later time while calling the callback).
I don't have many more ideas, maybe a stack corruption? It can be due to a mismatch between the
class delcaration and the real content of the dll. It may happen if you updated your card drivers without updating the SDK (or opposite). So check that the version of the dll you are using matches the version of your SDK.
You can also try to make it work first in a native application. For example, the SDK probably comes with a set of sample applications with code: compile the samples (the ones with the callback function of course) and test them to see if they crash or not. If they crash, most likely it means you have the problem I described (mismatch version between SDK and installed drivers). It they don't crash, then check carefully what are the differences between your code and theirs...
If you still can't fix it, I advise you to ask directly to the card provider (or distributor): they probably have a technical team that could help you.