[Cffi-devel] possible cffi bug

Joeish W joeish80829 at yahoo.com
Sun Apr 13 20:27:17 UTC 2014


I have these 2  wrappers for the C++ vector class and I wrap both in CFFI the same way, and call them 
the same way but I'm getting unhandled memory fault errors when using my wrapper for the carraytovectorm, The only difference being, using the carraytovectorp as an example of all my other carraytovector type c wrappers that are written the same way, is that when I initialize the Point class to pass to the carraytovectorp I can do it like this:

Point* m, n, o;
vector_Point* v = std_carrayTovectorp(m, 3);

and it works but when I attempt to do the same thing with carrayvectorm like so:

Mat* m, n, o;
vector_Mat* v = std_carrayTovectorm(m, 3);

I get a segmentation fault error in C

This works in both though.

Point m, n, o;
vector_Point* v = std_carrayTovectorp(&m, 3);


If you think this might be a bug too..I can forward any other info needed to debug..I just tried to keep this post light so it wouldn't seem daunting:)





vector_Mat* std_carrayTovectorm(Mat* a, size_t len) {
vector<Mat>* v = new vector<Mat>;
for(size_t i = 0; i < len; i++)
v->push_back(a[i]);
return v;
}
vector_Point* std_carrayTovectorp(Point* a, size_t len) {
    vector<Point>* v = new vector<Point>;
    for(size_t i = 0; i < len; i++) 
        v->push_back(a[i]);
    return v;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140413/193d2826/attachment.html>


More information about the cffi-devel mailing list