Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Thanks a lot! That really helped :) How would I go If I wanted to pass a list of points to the C-side to edit them? I already tried nesting the structs on the python side, but upon execution I get an access violation error! Commented Mar 15, 2019 at 12:51
  • But you're already editing them. The values from the xdata array are set from C. Commented Mar 15, 2019 at 13:10
  • Haha, yes I know! Maybe I didnt formulate my intention clear enough - say, I have a list of n Point-objects on the Python-side. Now I want to pass that list to a function (the entire list, not all n points separately - they have to be present on the C side at the same time). This function, on the C-side, should iterate through the list and edit the data from each of these n points. I thought about doing something like class pointList(ctypes.Structure): _fields_ = [('1',point), ('2',point), ... ('n',point),] and then passing this to a function, along with the number n. Commented Mar 15, 2019 at 13:15
  • Then use an array of points. What you're suggesting is not possible (at least not in that form). Check stackoverflow.com/questions/55103298/… - you'd have to do something similar to CharArr (somewhere at the end of main). Commented Mar 15, 2019 at 13:22
  • Thanks man! I found a workaround by passing several points separately, but storing them in a std::vector<Point*> on the C-side. Appreciate your help! Commented Mar 18, 2019 at 12:55