I have a Scheme file that loads some dependencies:
;; main.ss
(load "a.ss") (load "b.ss")
(define (main) (call-procs-in-a-and-b))
(main)
I generate an executable like this
$ gsc -o myapp -exe main.ss
When I run `myapp`, it is still looking for `a.ss` and `b.ss`. How can I make sure that these files also get compiled and linked to the executable? Do I have to compile them separately?
Thanks,
--Vijay
Afficher les réponses par date
I have a Scheme file that loads some dependencies: ;; main.ss (load "a.ss") (load "b.ss") (define (main) (call-procs-in-a-and-b)) (main) I generate an executable like this $ gsc -o myapp -exe main.ss When I run `myapp`, it is still looking for `a.ss` and `b.ss`. How can I make sure that these files also get compiled and linked to the executable? Do I have to compile them separately?
LOAD is called at runtime, it is thus normal that it looks for those files after you compiled. You can try INCLUDE instead, which is a macro and should textually put the contents of a.ss and b.ss in main.ss before compilation. You could also gsc a.scm gsc b.scm to compile the two files, then just do (load "a") and (load "b") without the extension in main.scm, and finally gsc -exe main.scm Then, your binary main will load at run time the compiled binaries a.o1 and b.o1.
Cheers,
P!
You can also compile a.ss b.ss main.ss separately into object files, and link them together into one executable file. In this case you leave any load or include out of either of the files.
2011/11/12 Adrien Piérard pierarda@iro.umontreal.ca
I have a Scheme file that loads some dependencies: ;; main.ss (load "a.ss") (load "b.ss") (define (main) (call-procs-in-a-and-b)) (main) I generate an executable like this $ gsc -o myapp -exe main.ss When I run `myapp`, it is still looking for `a.ss` and `b.ss`. How can I make sure that these files also get compiled and linked to the executable? Do I have to compile them separately?
LOAD is called at runtime, it is thus normal that it looks for those files after you compiled. You can try INCLUDE instead, which is a macro and should textually put the contents of a.ss and b.ss in main.ss before compilation. You could also gsc a.scm gsc b.scm to compile the two files, then just do (load "a") and (load "b") without the extension in main.scm, and finally gsc -exe main.scm Then, your binary main will load at run time the compiled binaries a.o1 and b.o1.
Cheers,
P!
Français, English, 日本語, 한국어 _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Thanks for helping me out! I decided to load object files and it works fine.
--Vijay
On Sat, Nov 12, 2011 at 2:37 PM, Mikael mikael.rcv@gmail.com wrote:
You can also compile a.ss b.ss main.ss separately into object files, and link them together into one executable file. In this case you leave any load or include out of either of the files.
2011/11/12 Adrien Piérard pierarda@iro.umontreal.ca
I have a Scheme file that loads some dependencies: ;; main.ss (load "a.ss") (load "b.ss") (define (main) (call-procs-in-a-and-b)) (main) I generate an executable like this $ gsc -o myapp -exe main.ss When I run `myapp`, it is still looking for `a.ss` and `b.ss`. How can I make sure that these files also get compiled and linked to the executable? Do I have to compile them separately?
LOAD is called at runtime, it is thus normal that it looks for those files after you compiled. You can try INCLUDE instead, which is a macro and should textually put the contents of a.ss and b.ss in main.ss before compilation. You could also gsc a.scm gsc b.scm to compile the two files, then just do (load "a") and (load "b") without the extension in main.scm, and finally gsc -exe main.scm Then, your binary main will load at run time the compiled binaries a.o1 and b.o1.
Cheers,
P!
Français, English, 日本語, 한국어 _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On 2011-11-12, at 6:47 AM, Vijay Mathew wrote:
Thanks for helping me out! I decided to load object files and it works fine.
Doing it like this:
;; main.ss
(load "a") (load "b")
(define (main) (call-procs-in-a-and-b))
(main)
also has the advantage that the source files (a.ss and b.ss) will be loaded by "load" if the source files have been modified after the last compilation to .o1 files. This is useful for debugging.
Marc