Hi,
I am trying to convert a std string to a BSTR. I am using Dev C++ with mingw on windows. As far as I am aware I cannot use the ATL libraries with Dev C++ so i cannot use A2BSTR etc. Here is my code:
The header for open slide function in the wrapper dll is:Code:string path = getImagePath(); //eg C:/T2 int location = 0; while(path.find("/",0) != string::npos) //converts image path to C:\\T2 { location = path.find("/",0); path.replace(location,1,"\\\\"); } OpenSlide(path.c_str()); //a function in a wrapper dll which takes a LPCSTR of format C:\\T2
This wrapper DLL calls a function from another DLL that has a header:Code:// Open Slide EXTERN_C __declspec(dllexport) BOOL WINAPI OpenSlide(LPCSTR SlideName);
This all compiles but crashes when OpenSlide() is called. If I hard code the correct path and pass it in it seems to work however ie path = "C:\\T2";Code:virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OpenSlide( /* [in] */ BSTR SlideName) = 0;
Any help would be greatly appreciated,
Alex



LinkBack URL
About LinkBacks


