1
0
mirror of https://github.com/janet-lang/janet synced 2025-01-24 06:06:52 +00:00

jpm: Read :lflags from meta file when linking.

Let us link in native code that itself neads to be linked
to native code when creating standalone executables.
This commit is contained in:
Calvin Rose 2019-09-21 18:57:04 -05:00
parent 1b283c47b4
commit 940860755c
2 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## Unreleased ## Unreleased
- Fix some linking issues when creating executables with native dependencies.
- jpm now runs each test script in a new interpreter.
- Fix an issue that prevent some valid programs from compiling. - Fix an issue that prevent some valid programs from compiling.
- Add `mean` to core. - Add `mean` to core.
- Allow (length x) on typed arrays an other abstract types that implement - Allow (length x) on typed arrays an other abstract types that implement

View File

@ -385,6 +385,7 @@
# Load entry environment and get main function. # Load entry environment and get main function.
(def entry-env (dofile source)) (def entry-env (dofile source))
(def main ((entry-env 'main) :value)) (def main ((entry-env 'main) :value))
(def dep-lflags @[])
# Create marshalling dictionary # Create marshalling dictionary
(def mdict (invert (env-lookup root-env))) (def mdict (invert (env-lookup root-env)))
@ -416,6 +417,8 @@
" janet_env_lookup_into(lookup, temptab, \"" " janet_env_lookup_into(lookup, temptab, \""
prefix prefix
"\", 0);\n\n") "\", 0);\n\n")
(when-let [lfs (meta :lflags)]
(array/concat dep-lflags lfs))
(buffer/push-string declarations (buffer/push-string declarations
"extern void " "extern void "
(meta :static-entry) (meta :static-entry)
@ -500,7 +503,7 @@ int main(int argc, const char **argv) {
#default #default
["-lm"])) ["-lm"]))
(def cc (opt opts :compiler default-compiler)) (def cc (opt opts :compiler default-compiler))
(def lflags [;(opt opts :lflags default-lflags) ;extra-lflags]) (def lflags [;dep-lflags ;(opt opts :lflags default-lflags) ;extra-lflags])
(def cflags (getcflags opts)) (def cflags (getcflags opts))
(def defines (make-defines (opt opts :defines {}))) (def defines (make-defines (opt opts :defines {})))
(print "compiling and linking " dest "...") (print "compiling and linking " dest "...")