所以我在将Mingw编译的C ++ DLL添加到我的msvc项目时遇到了一些麻烦。我已经解决了一些人似乎有关于链接的问题,但现在当我在dll中调用函数时,我已经添加了一个“访问冲突读取位置0x00000014”错误,这会破坏new.cpp中的operator new方法(在visual studio 2010中)。我已经读到与内存管理有区别,我想知道这是否可能是我的麻烦的来源。
我正在尝试构建和运行的特定DLL是cvBlobs,可以在这里找到 - https://code.google.com/p/cvblob/,由于某些原因,我在使用mingw进行编译时不知道它的速度要快很多倍。
我对这些事情都很陌生,但我想知道是什么可能是haing dll是在调用msvc new()方法吗?那有意义吗?我看过mingw网站上的帮助,但虽然这对我说到这一点很有用,但似乎没有帮助解决这个问题。如果您希望我提供任何其他内容,请与我们联系。
编辑: 我已经从我的Visual Studio编译代码中包含了特定的有问题的代码,希望它可以提供一些清晰度。
//Grey is a greyscale image, thresh is that image thresholded
cvThreshold(grey,thresh,0,255,CV_THRESH_OTSU);
IplImage* outputImg = cvCreateImage(cvGetSize(thresh), IPL_DEPTH_LABEL, 1);
//Blobs is where the found blobs are outputted too
cvb::CvBlobs blobs;
unsigned int result;
//This is the problematic method, it is in the mingw compiled dll,
//other methods from this dll seem to work. I'm tempted to say that
//the problem comes in the cvLabel method, where a varible "CvBlob blob" is
//first initalized. This is due to the stack trace that I am including
//under this edit
result = cvb::cvLabel(thresh, outputImg, blobs);
这是我提到的堆栈跟踪更高
cvBlobs.dll!6e313f95()
[Frames below may be incorrect and/or missing, no symbols loaded for cvBlobs.dll]
cvBlobs.dll!6e30135b()
msvcr100d.dll!operator new(unsigned int size) Line 59C++
nuon.dll!std::_Allocate<std::_Tree_nod<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Node>(unsigned int _Count, std::_Tree_nod<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Node * __formal) Line 36 + 0x15 bytes C++
nuon.dll!std::allocator<std::_Tree_nod<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Node>::allocate(unsigned int _Count) Line 187 + 0xb bytes C++
nuon.dll!std::_Tree_val<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Tree_val<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >(const std::less<unsigned int> & _Parg, std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > _Al) Line 550 + 0xc bytes C++
nuon.dll!std::_Tree<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >::_Tree<std::_Tmap_traits<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> >,0> >(const std::less<unsigned int> & _Parg, const std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > & _Al) Line 699 C++
nuon.dll!std::map<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > >::map<unsigned int,cvb::CvBlob *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,cvb::CvBlob *> > >() Line 107 C++
nuon.dll!nuon::MarkerDetector::detect(cv::Mat & input, std::vector<nuon::Marker,std::allocator<nuon::Marker> > & detectedMarkers, nuon::CameraParameters camParams, float markerSizeMeters, bool setYPerperdicular) Line 201 C++
我希望这个编辑可能有助于为某人澄清这个