diff --git a/libsolc/libsolc.cpp b/libsolc/libsolc.cpp index 060baaa2a..29b732156 100644 --- a/libsolc/libsolc.cpp +++ b/libsolc/libsolc.cpp @@ -53,7 +53,7 @@ ReadCallback::Callback wrapReadCallback(CStyleReadFileCallback _readCallback = n if (!contents_c && !error_c) { result.success = false; - result.responseOrErrorMessage = "File not found."; + result.responseOrErrorMessage = "Callback not supported."; } if (contents_c) { diff --git a/libsolc/libsolc.h b/libsolc/libsolc.h index 2c55c2342..a4ca377a2 100644 --- a/libsolc/libsolc.h +++ b/libsolc/libsolc.h @@ -36,7 +36,13 @@ extern "C" { /// Callback used to retrieve additional source files. /// -/// "Returns" two pointers that should be heap-allocated and are free'd by the caller. +/// @param _path The path for loading. +/// @param o_contents A pointer to the contents of the file, if found. +/// @param o_error A pointer to an error message, if there is one. +/// +/// If the callback is not supported, o_contents and o_error should be set to NULL. +/// +/// The two pointers (o_contents and o_error) should be heap-allocated and are free'd by the caller. typedef void (*CStyleReadFileCallback)(char const* _path, char** o_contents, char** o_error); /// Returns the complete license document. @@ -52,7 +58,10 @@ char const* solidity_version() SOLC_NOEXCEPT; /// Takes a "Standard Input JSON" and an optional callback (can be set to null). Returns /// a "Standard Output JSON". Both are to be UTF-8 encoded. /// -/// The pointer returned must not be freed by the caller. +/// @param _input +/// @param _readCallback +/// +/// @returns A pointer to the result. The pointer returned must not be freed by the caller. char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback) SOLC_NOEXCEPT; /// Frees up any allocated memory. diff --git a/test/libsolidity/LibSolc.cpp b/test/libsolidity/LibSolc.cpp index b94486ac8..3f55cdaed 100644 --- a/test/libsolidity/LibSolc.cpp +++ b/test/libsolidity/LibSolc.cpp @@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(with_callback) BOOST_CHECK(containsError(result, "ParserError", "Source \"missing.sol\" not found: Missing file.")); // This should be placed due to the missing "notfound.sol" which sets both pointers to null. - BOOST_CHECK(containsError(result, "ParserError", "Source \"notfound.sol\" not found: File not found.")); + BOOST_CHECK(containsError(result, "ParserError", "Source \"notfound.sol\" not found: Callback not supported.")); } BOOST_AUTO_TEST_SUITE_END()