Avoid losing results when working with CUDA and WinForms
I made a project on Win Forms, and in Visual Studio I made a second project using CUDA code. The idea is that the image from the form goes to CUDA, it is processed there and returned. But then the difficulties began – the result of the function, in theory, should be written to a variable of the Image class, and then the drawing is output to the form using this variable, but… Visual Studio tells me – an attempt to access protected memory. I have no idea how to get around, I thought and searched for quite a long time. Somehow fix the studio, fix the code or whatever, maybe it’s in the PC. Later, I think I’ll rewrite the code so that only the number, not the image, is transmitted back from CUDA, but I’m afraid in advance that it won’t work. The code is attached below.