Repository: lucy-charmonizer Updated Branches: refs/heads/master e27e69383 -> 9ad0470af
Add chaz_CC_test_link Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/9ad0470a Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/9ad0470a Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/9ad0470a Branch: refs/heads/master Commit: 9ad0470af951671ed842e795734ee8750672d991 Parents: e27e693 Author: Nick Wellnhofer <[email protected]> Authored: Thu Dec 4 21:51:48 2014 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Thu Dec 4 21:51:48 2014 +0100 ---------------------------------------------------------------------- src/Charmonizer/Core/Compiler.c | 12 ++++++++++++ src/Charmonizer/Core/Compiler.h | 6 ++++++ 2 files changed, 18 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/9ad0470a/src/Charmonizer/Core/Compiler.c ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Core/Compiler.c b/src/Charmonizer/Core/Compiler.c index 9317c42..17ca3e8 100644 --- a/src/Charmonizer/Core/Compiler.c +++ b/src/Charmonizer/Core/Compiler.c @@ -280,6 +280,18 @@ chaz_CC_test_compile(const char *source) { return compile_succeeded; } +int +chaz_CC_test_link(const char *source) { + int link_succeeded; + if (!chaz_Util_remove_and_verify(chaz_CC.try_exe_name)) { + chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_exe_name); + } + link_succeeded = chaz_CC_compile_exe(CHAZ_CC_TRY_SOURCE_PATH, + CHAZ_CC_TRY_BASENAME, source); + chaz_Util_remove_and_verify(chaz_CC.try_exe_name); + return link_succeeded; +} + char* chaz_CC_capture_output(const char *source, size_t *output_len) { char *captured_output = NULL; http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/9ad0470a/src/Charmonizer/Core/Compiler.h ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Core/Compiler.h b/src/Charmonizer/Core/Compiler.h index af1a7dd..e916553 100644 --- a/src/Charmonizer/Core/Compiler.h +++ b/src/Charmonizer/Core/Compiler.h @@ -48,6 +48,12 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_path, int chaz_CC_test_compile(const char *source); +/* Attempt to compile and link the supplied source code and return true if + * the effort succeeds. + */ +int +chaz_CC_test_link(const char *source); + /* Attempt to compile the supplied source code. If successful, capture the * output of the program and return a pointer to a newly allocated buffer. * If the compilation fails, return NULL. The length of the captured
