Using GLFW C api I have wrapped a simple function as a shared library
// myfunction.h
__declspec(dllexport) int glfwGetSkinSurface(GLFWwindow* window);
then the shared library is loaded in python using ctypes.
import ctypes as ct
clib = ct.CDLL("myfunction.dll")
glfwGetSkinSurface = clib.glfwGetSkinSurface
glfwGetSkinSurface.argtypes = [ct.c_void_p] # <- correct?
glfwGetSkinSurface.restypes = [ct.c_int]
then calling the function from another file in these formats. All of them are producing an error.
result = glfwGetSkinSurface(glfw.get_window_user_pointer(window))
# OSError: exception: access violation reading 0x0000000000000358
result = glfwGetSkinSurface(ct.c_void_p(glfw.get_window_user_pointer(window)))
# OSError: exception: access violation reading 0x0000000000000358
result = glfwGetSkinSurface(ct.cast(glfw.get_window_user_pointer(window), ct.c_void_p))
# OSError: exception: access violation reading 0x0000000000000358
How do I solve this problem?
Prashant