To put this in context, I create a wrapper for the C DLL - a rather confusing use case, but please stick with me!
During the initialization of my wrapper class, I create aliases for my DLL functions, so my class can easily access them later. An additional task that I perform is to pass a function call inside my class to my DLL, which is stored in a static variable and used later.
Finally, I create another thread that repeatedly calls a function in my DLL, which does some work and at various points in its execution, needs a callback to the Python program using the callback assigned during the initialization phase of my class.
When the callback is called this way, I get the following:
WindowsError: exception: access violation reading 0x00000001
I suspect this is due to threading, because when I test the callback in the same thread that I assigned it to, the DLL can successfully call it, and all my arguments are passed through Python. Is there some kind of protection applied to my variable in my DLL that I use to save my callback?
source share