Skip to content

Commit 415d791

Browse files
authored
Merge pull request #12 from lucatrv/hotfix/multi-platform-support
Multi platform support, fixes issues #7 #8 #9
2 parents 24b99ef + 41b939c commit 415d791

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
*.so
44
*.dylib
55
*.dll
6+
*.exe
67
hello

juliac.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function compile(julia_program_file, julia_install_path,
66
filename = split(julia_program_file, ".")[1]
77
O_FILE = "$(filename).o"
88

9-
SYS_LIB = joinpath(julia_install_path, "lib", "julia", "sys")
109
JULIA_EXE = joinpath(julia_install_path, "bin", "julia")
1110
LIB_PATH = joinpath(julia_install_path, "lib")
1211
SO_FILE = "lib$(filename).$(Libdl.dlext)"
@@ -15,7 +14,7 @@ function compile(julia_program_file, julia_install_path,
1514
julia_program_file = replace(julia_program_file, "\\", "\\\\")
1615
end
1716

18-
run(`"$(Base.julia_cmd())" "-J$(SYS_LIB)" "--startup-file=no" "--output-o" "$(O_FILE)" "-e" "
17+
run(`"$(Base.julia_cmd())" "--startup-file=no" "--output-o" "$(O_FILE)" "-e" "
1918
vers = \""v$(VERSION.major).$(VERSION.minor)"\"
2019
const DIR_NAME = \"".julia"\"
2120
push!(Base.LOAD_CACHE_PATH, abspath(\""$julia_pkgdir"\", \""lib"\", vers))
@@ -28,7 +27,7 @@ function compile(julia_program_file, julia_install_path,
2827
ldlibs = Base.shell_split(readstring(`$(JULIA_EXE) $(joinpath(julia_install_path, "share", "julia", "julia-config.jl")) --ldlibs`))
2928

3029
if is_windows()
31-
run(`x86_64-w64-mingw32-gcc -m64 -fPIC -shared -o $(SO_FILE) $(O_FILE) $(ldflags) $(ldlibs)`)
30+
run(`x86_64-w64-mingw32-gcc -m64 -fPIC -shared -o $(SO_FILE) $(O_FILE) $(ldflags) $(ldlibs) -Wl,--export-all-symbols`)
3231
run(`x86_64-w64-mingw32-gcc -m64 program.c -o $(filename).exe $(SO_FILE) $(cflags) $(ldflags) $(ldlibs) -lopenlibm -Wl,-rpath,\$ORIGIN`)
3332
else
3433
run(`g++ -m64 -fPIC -shared -o $(SO_FILE) $(O_FILE) $(ldflags) $(ldlibs)`)

0 commit comments

Comments
 (0)