diff --git a/common/cpp/include/asapo/common/common_c.h b/common/cpp/include/asapo/common/common_c.h index 54a6f6b4a0b53dedeefe15afda5c0c8d0ad73543..932e9c030fa2415a3e76ed9ccf8115d6c279c17e 100644 --- a/common/cpp/include/asapo/common/common_c.h +++ b/common/cpp/include/asapo/common/common_c.h @@ -20,6 +20,7 @@ void* asapo_new_handle(); void asapo_error_explain(const AsapoErrorHandle error, char* buf, size_t max_size); AsapoBool asapo_is_error(AsapoErrorHandle err); +AsapoStringHandle asapo_string_create(const char* str); const char* asapo_string_c_str(const AsapoStringHandle str); size_t asapo_string_size(const AsapoStringHandle str); diff --git a/common/cpp/src/common/common_c_glue.cpp b/common/cpp/src/common/common_c_glue.cpp index 626deb835fe87d011a616901b48a0d8327249bff..f1903f70cbc996e84988ec776017ee0aec5a5955 100644 --- a/common/cpp/src/common/common_c_glue.cpp +++ b/common/cpp/src/common/common_c_glue.cpp @@ -32,6 +32,12 @@ AsapoHandle* handle_or_null(AsapoHandle* handle, AsapoErrorHandle* error, asapo: extern "C" { + AsapoStringHandle asapo_string_create(const char* str) { + return AsapoStringHandle(new std::string(str)); + } + + + //! free handle memory, set handle to NULL /// \param[in] pointer to an ASAPO handle void asapo_free_handle(void** handle) {