converter error

Hey folks

I got the following function definiton
1
2
3
4
ReportResult SendCrashReport(const wstring &url,
                             const map<wstring, wstring> &parameters,
                             const map<wstring, wstring> &files,
                             wstring *report_code);


And this is how I call it
1
2
3
const std::map<wstring, wstring> params;
std::wstring filename = L"C:\\Temp\\TestCrashReport.dmp";
ReportResult r = sender.SendCrashReport(L"http://devomaha/service", params, filename, 0);


but somehow I get an exception when I try to build my project

error C2664: 'google_breakpad::ReportResult google_breakpad::CrashReportSender::SendCrashReport(const std::wstring &,const std::map<std::wstring,std::wstring,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>> &,const std::map<_Kty,_Ty,std::less<_Ty>,std::allocator<std::pair<const _Kty,_Ty>>> &,std::wstring *)': cannot convert argument 3 from 'std::wstring' to 'const std::map<std::wstring,std::wstring,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>> &'


Can somebody help me with this? The argument list in the combiler output is compleatly diffrent to the one in the specified header file and I have no clue why.

I just found the following code and I never worked with templates before.. can I just initialise an object of this template class? And why is the argument list in the header file compleatly diffrent but still expects the following?
1
2
3
4
5
6
7
template<class _Kty,
	class _Ty,
	class _Pr = less<_Kty>,
	class _Alloc = allocator<pair<const _Kty, _Ty> > >
	class map
		: public _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, false> >
	{	/* ........... members */ }


The source for breakpad can be found here https://github.com/google/breakpad
Last edited on
As the error message said, simplifying, "cannot call SendCrashReport, because cannot convert argument 3 from wstring to map"

Your argument 3 is "filename", defined as std::wstring filename

Your parameter 3 is const map<wstring, wstring> &files


Thanks for the answer and sorry for the stupid question..
I got it working.. (fighting with other problems^^)

Do I understand it right that i defined "_Kty" and "_Ty" as wstring and "_Pr" and "_Alloc" will take the default value?

Is this a good practice to write that many templates? In my option it is messy at first sight and hard to understand when looking deeper. Why not use fixed typed classes or structs?

Maybe you can also point me out how to convert this function?^^

1
2
3
4
5
6
  typedef bool (*MinidumpCallback)(const wchar_t* dump_path,
                                   const wchar_t* minidump_id,
                                   void* context,
                                   EXCEPTION_POINTERS* exinfo,
                                   MDRawAssertionInfo* assertion,
                                   bool succeeded);


 
static bool DmpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded) { }


1
2
3
4
5
6
7
8
ExceptionHandler::ExceptionHandler(const wstring& dump_path,
                                   FilterCallback filter,
                                   MinidumpCallback callback,
                                   void* callback_context,
                                   int handler_types,
                                   MINIDUMP_TYPE dump_type,
                                   HANDLE pipe_handle,
                                   const CustomClientInfo* custom_info) {



1
2
3
4
5
6
7
8
9
exceptionHandler = new ExceptionHandler(
				L"C:\\Temp\\dumps\\",
				0,
				DmpCallback,
				0,
				google_breakpad::ExceptionHandler::HANDLER_ALL,
				MiniDumpNormal,
				L"",
				0);


The 3. parameter is the one which throws the exception
error C2664: 'google_breakpad::ExceptionHandler::ExceptionHandler(const google_breakpad::ExceptionHandler &)': cannot convert argument 3 from 'bool (__clrcall *)(const wchar_t *,const wchar_t *,void *,EXCEPTION_POINTERS *,MDRawAssertionInfo *,bool)' to 'google_breakpad::ExceptionHandler::MinidumpCallback'
Last edited on
"__clrcall" implies you are not compiling a C++ program. You're compiling a Microsoft C++/CLI program instead - a different programming language, although it's very similar to C++ in many ways. I guess that MinidumpCallback expects a C++ function - I've never used managed C++ so I don't really know how they interact, but from what I could learn online, declaring DmpCallback as bool __cdecl DmpCallback ( might help, and obviously making a proper C++ (not any sort of "Managed" or CLI) project should help further.
Thanks for the answer.
I'll try it tomorrow.

To explain the managed code: I'm writing a managed class wrapper https://msdn.microsoft.com/en-us/library/ms235281.aspx for breakpad to use it in my .NET application.

Detail:
I have a .NET Core client application possible with Xamarin. (multiplatform support)
Now I want to distribute my project to my customers.
For that purpose I use google's omaha and the server implementation of crystalnix. These two projects are here to install and update software on windows. The server implementation proviedes additional functionalities like receving and displaying crash reports sent by breakpad.
So I'll wrapp the breakpad library for use in .NET so I don't have to worry about other exception logging methods compatible with my server. Furthermore I plan to use Sparkle for mac distribution as the server also supports this.
Last edited on
the calling convention didn't help. I just marked my callback function (DmpCallback) as unmanaged und now everything is fine. As I don't need the callback function in my .NET code this solution should be perfect
Topic archived. No new replies allowed.