Commit 429a231c authored by Ronan's avatar Ronan
Browse files

fix(c-wrapper): use abort instead of fatal

parent 18f0782b
...@@ -113,9 +113,9 @@ private: ...@@ -113,9 +113,9 @@ private:
// Runtime checker. // Runtime checker.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
static inline void fatal (const char *message) { static inline void abort (const char *message) {
std::cout << "[FATAL C-WRAPPER]" << message << std::endl; std::cerr << "[FATAL C-WRAPPER]" << message << std::endl;
//exit(1); std::abort();
} }
public: public:
...@@ -135,7 +135,7 @@ public: ...@@ -135,7 +135,7 @@ public:
CppDerivedPrivateType *derived = dynamic_cast<CppDerivedPrivateType *>(base); CppDerivedPrivateType *derived = dynamic_cast<CppDerivedPrivateType *>(base);
if (!derived) if (!derived)
fatal("Invalid cast."); abort("Invalid cast.");
return derived; return derived;
#else #else
return static_cast<CppDerivedPrivateType *>(base); return static_cast<CppDerivedPrivateType *>(base);
...@@ -170,11 +170,11 @@ public: ...@@ -170,11 +170,11 @@ public:
std::shared_ptr<BaseType> cppObject = reinterpret_cast<WrappedObject<BaseType> *>(cObject)->cppPtr; std::shared_ptr<BaseType> cppObject = reinterpret_cast<WrappedObject<BaseType> *>(cObject)->cppPtr;
if (!cppObject) if (!cppObject)
fatal("Cpp Object is null."); abort("Cpp Object is null.");
std::shared_ptr<DerivedType> derivedCppObject = std::static_pointer_cast<DerivedType>(cppObject); std::shared_ptr<DerivedType> derivedCppObject = std::static_pointer_cast<DerivedType>(cppObject);
if (!derivedCppObject) if (!derivedCppObject)
fatal("Invalid derived cpp object."); abort("Invalid derived cpp object.");
return derivedCppObject; return derivedCppObject;
#else #else
...@@ -207,11 +207,11 @@ public: ...@@ -207,11 +207,11 @@ public:
BaseType *cppObject = reinterpret_cast<WrappedClonableObject<BaseType> *>(cObject)->cppPtr; BaseType *cppObject = reinterpret_cast<WrappedClonableObject<BaseType> *>(cObject)->cppPtr;
if (!cppObject) if (!cppObject)
fatal("Cpp Object is null."); abort("Cpp Object is null.");
DerivedType *derivedCppObject = dynamic_cast<DerivedType *>(cppObject); DerivedType *derivedCppObject = dynamic_cast<DerivedType *>(cppObject);
if (!derivedCppObject) if (!derivedCppObject)
fatal("Invalid derived cpp object."); abort("Invalid derived cpp object.");
return derivedCppObject; return derivedCppObject;
#else #else
...@@ -294,9 +294,9 @@ public: ...@@ -294,9 +294,9 @@ public:
return nullptr; return nullptr;
try { try {
return getCBackPtr(std::static_pointer_cast<CppType>(cppObject->shared_from_this())); return getCBackPtr(std::static_pointer_cast<CppType>(cppObject->sharedFromThis()));
} catch (const std::bad_weak_ptr &e) { } catch (const std::bad_weak_ptr &e) {
fatal(e.what()); abort(e.what());
} }
L_ASSERT(false); L_ASSERT(false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment