How to create a dynamically linked executable in Racket?

I am trying to create an executable file in a racket dynamically linked. My world hello program is currently compiling into a 4MB executable. There he is:

#!/usr/bin/env racket  
#lang racket  

(define (extract str)  
  (substring str 4 7))  

(print (extract "the cat out of the bag"))  

I will compile it with

raco exe first.rkt

And the resulting executable is 4+ MB. So it’s clear that this is the static link of the racket libraries.

- EDIT ---

Here is the startup code:

#lang racket

(require launcher/launcher)
(require racket/runtime-path)

(define-runtime-path prog-path "first.rkt")

(make-racket-launcher (list (path->string prog-path))
                      "first"
                      '())

You just need to insert a separate file and execute using

 racket <launch-file>.rkt
+5
source share
2 answers

raco exe , , . launcher? exe, .

, #lang racket/base, , .

, Unix, , (x) , #!/usr/bin/env . , Racket PATH. . http://docs.racket-lang.org/guide/scripts.html

+7

Have you tried distributing raco?

The documentation is here: http://docs.racket-lang.org/raco/exe-dist.html

+2
source

All Articles