stl vector dll boundary issue

asked 2012-11-02 10:48:31 -0500

chris gravatar image

The following code causes a problem:

vector<keypoint> keyPts;

GoodFeaturesToTrackDetector fd(...);

fd.detect(rROI, keyPts);

when keyPts goes out of scope.
Triggers a breakpoint due to invalid heap address. If I presize the vector prior to calling detect, then it seems to work fine but this defeats the purpose of using an stl container. I believe this is related to questions I have seen about the problem of passing stl containers across dll-exe memory boundaries. (http://stackoverflow.com/questions/10573130/implications-of-using-stdvector-in-a-dll-exported-function)

Any suggestions??

edit retag flag offensive close merge delete