Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/embedding_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,23 @@ void set_depot_load_path(const char *root_dir) {

// main function (windows UTF16 -> UTF8 argument conversion code copied from
// julia's ui/repl.c)
#ifdef _WIN32
int wmain(int argc, wchar_t *wargv[], wchar_t *envp[]) {
char **argv = (char **)malloc(sizeof(char *) * argc);
if (!argv) return 1;

for (int i = 0; i < argc; i++) { // write the command line to UTF8
wchar_t *warg = wargv[i];
size_t len = WideCharToMultiByte(CP_UTF8, 0, warg, -1, NULL, 0, NULL, NULL);
if (!len) return 1;
char *arg = (char *)malloc(len);
if (!WideCharToMultiByte(CP_UTF8, 0, warg, -1, arg, len, NULL, NULL)) return 1;
argv[i] = arg;
}
#else
int main(int argc, char *argv[]) {
argv = uv_setup_args(argc, argv); // no-op on Windows
argv = uv_setup_args(argc, argv);
#endif

// Find where eventual julia arguments start
int program_argc = argc;
Expand Down
3 changes: 3 additions & 0 deletions src/juliaconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
if Sys.isunix()
print(flags, " -fPIC")
end
if Sys.iswindows()
print(flags, " -municode")

Check warning on line 65 in src/juliaconfig.jl

View check run for this annotation

Codecov / codecov/patch

src/juliaconfig.jl#L65

Added line #L65 was not covered by tests
end
return String(take!(flags))
end

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ end
rm(joinpath(new_depot, "artifacts"); recursive=true, force=true)
end # try
app_path(app_name) = abspath(app_compiled_dir, "bin", app_name * (Sys.iswindows() ? ".exe" : ""))
app_output = read(`$(app_path("MyApp")) I get --args --julia-args --threads=3 --check-bounds=yes -O1`, String)
app_output = read(`$(app_path("MyApp")) I get --args áéíóú --julia-args --threads=3 --check-bounds=yes -O1`, String)

# Check stdlib filtering
if filter == true
Expand All @@ -159,7 +159,7 @@ end
# Check artifact gets run from the correct place
@test occursin("HelloWorld artifact at $(realpath(app_compiled_dir))", app_output)
# Check ARGS
@test occursin("""ARGS = ["I", "get", "--args"]""", app_output)
@test occursin("""ARGS = ["I", "get", "--args", "áéíóú"]""", app_output)
# Check julia-args
@test occursin("(Base.JLOptions()).opt_level = 1", app_output)
@test occursin("(Base.JLOptions()).nthreads = 3", app_output)
Expand Down
Loading