| 93 | } |
| 94 | |
| 95 | MCAPI_ATTR McResult MCAPI_CALL mcDebugMessageCallback(McContext pContext, pfn_mcDebugOutput_CALLBACK cb, const McVoid* userParam) |
| 96 | { |
| 97 | McResult return_value = McResult::MC_NO_ERROR; |
| 98 | per_thread_api_log_str.clear(); |
| 99 | |
| 100 | if (pContext == nullptr) { |
| 101 | per_thread_api_log_str = "context ptr (param0) undef (NULL)"; |
| 102 | } else if (cb == nullptr) { |
| 103 | per_thread_api_log_str = "callback function ptr (param1) undef (NULL)"; |
| 104 | } else { |
| 105 | try { |
| 106 | debug_message_callback_impl(pContext, cb, userParam); |
| 107 | } |
| 108 | CATCH_POSSIBLE_EXCEPTIONS(per_thread_api_log_str); |
| 109 | } |
| 110 | |
| 111 | if (!per_thread_api_log_str.empty()) { |
| 112 | std::fprintf(stderr, "%s(...) -> %s\n", __FUNCTION__, per_thread_api_log_str.c_str()); |
| 113 | |
| 114 | if (return_value == McResult::MC_NO_ERROR) // i.e. problem with basic local parameter checks |
| 115 | { |
| 116 | return_value = McResult::MC_INVALID_VALUE; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | return return_value; |
| 121 | } |
| 122 | |
| 123 | MCAPI_ATTR McResult MCAPI_CALL mcGetDebugMessageLog( |
| 124 | McContext context, |