Joeish W joeish80829@yahoo.com writes:
This is important to figure out so I thought I'd include the contents of my C++ interop.cpp file in a gist https://gist.github.com/W-Net-AI/11319737%C2%A0 and my rect.cpp W-Net-AI/gist:11319776 you have my Lisp vector class wrappers so here is my Lisp rect wrappers...the rect is a little involved for the purpose of overloading.
Well, the code for Rect will work. However:
1. Notice that you deal with pointers to Rect's.
2. You do not have a function to free the memory created by the `new Rect'
3. You really should use the type conversion like I showed you before if you want to keep your sanity.
Now your problem with the vector<Rect> code boils down to the following mismatch:
A. The vector deals with instances of Rect NOT pointers to Rect B. The other code rect code expect pointers to Rect NOT instances of RECT.
So you have two options:
i. Only deal with pointers to Rect. This means you cannot use vector<Rect> but have to use vector<Rect*>.
ii. Learn to deal with both. This will require conversion from Rect <--> Rect*.
Now note, that if you want to keep using vector<Rect> you need to either: - Translate the vector<Rect> --> vector<Rect*> <-> Rect** on the C-side - Or do it on the lisp side, but that means that CFFI/Lisp need to know the size of the Rect instances.
Wim Oudshoorn