diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-07 03:21:28 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-07 03:21:28 +0000 |
commit | da83d210e08d1ee4cb17b86e8cbb482c9e70da9d (patch) | |
tree | 45d661728d0cc02f2cafaa4741dc347eda666a7e /mjit.c | |
parent | 0abd9b7f252129aae0c3f164e64dcb8479f661bc (diff) |
mjit mswin support (WIP)
* mjit.c (compile_c_to_so): fixed broken xfree position.
* mjit.c (init_header_filename): refactored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -682,7 +682,6 @@ compile_c_to_so(const char *c_file, const char *so_file) } args = form_args(4, (mjit_opts.debug ? VC_COMMON_ARGS_DEBUG : VC_COMMON_ARGS), output, input, libs); - xfree(output[0]); #else output[1] = so_file; if (mjit_opts.cc == MJIT_CC_CLANG) { @@ -700,6 +699,9 @@ compile_c_to_so(const char *c_file, const char *so_file) exit_code = exec_process(cc_path, args); xfree(args); +#ifdef _MSC_VER + xfree((char *)output[0]); +#endif if (exit_code != 0) verbose(2, "compile_c_to_so: compile error: %d", exit_code); @@ -1110,6 +1112,15 @@ init_header_filename(void) static const char header_name[] = "/" MJIT_HEADER_INSTALL_DIR "/" RUBY_MJIT_HEADER_FILE; char *p; +#ifdef _WIN32 + static const char libpathflag[] = +# ifdef _MSC_VER + "-LIBPATH:" +# else + "-L" +# endif + ; +#endif basedir_val = rb_const_get(rb_cObject, rb_intern_const("TMP_RUBY_PREFIX")); basedir = StringValuePtr(basedir_val); @@ -1128,20 +1139,12 @@ init_header_filename(void) fclose(f); #ifdef _WIN32 -# ifdef _MSC_VER - p = libruby_build = xmalloc(9 + baselen + 1); - p = append_str(p, "-LIBPATH:"); -#else - p = libruby_build = xmalloc(2 + baselen + 1); - p = append_str(p, "-L"); -#endif + p = libruby_build = xmalloc(sizeof(libpathflag)-1 + baselen + 1); + p = append_str(p, libpathflag); p = append_str2(p, basedir, baselen); *p = '\0'; -# ifdef _MSC_VER - libruby_installed = xmalloc(9 + baselen + 4 + 1); -#else - libruby_installed = xmalloc(2 + baselen + 4 + 1); -#endif + + libruby_installed = xmalloc(sizeof(libpathflag)-1 + baselen + 4 + 1); p = append_str2(libruby_installed, libruby_build, p - libruby_build); p = append_str(p, "/lib"); *p = '\0'; |