On Monday, February 20, 2017 at 12:33:46 PM UTC-7, lu wrote:
> In fact, I'm wondering if `raco distribute` or `raco exe` is flexible enough 
> to produce a statically linked executable where all the necessary dlls are 
> incorporated.

I believe this is possible, but probably not worth the effort considering you 
mentioned this as a toy project. To my understanding (and, please, someone 
correct me if I am wrong about this), `raco exe` will just compile your file to 
Racket bytecode, then intelligently mash it together with the racket executable 
you have installed. If the racket executable you have installed requires 
loading an external dll, then so will the executable created from `raco exe`. 
If the racket executable you have installed does NOT require an external dll, 
then neither will your executable generated from `raco exe`. The default 
Windows installer distributed for racket has the core of the language linked as 
a separate `libracket` dll, so `raco exe` follows suit. Partially this is an 
issue at the OS and linker level; after compilation, dynamically linked 
libraries can't easily be transformed to statically linked libraries and 
vice-versa. It is almost universally a compile time choice. To be clear, I am 
talking about code compiled to native machine bytecode tailored to a particular 
operating system from a source language like C, not compiled Racket bytecode.

Which brings me to my next point. To make this work, you would pretty much need 
to compile the Racket executable from source and use whatever compile flags are 
required to build everything statically into the main executable. Then `raco 
exe` should work as expected using your custom compiled version of Racket. This 
is a huge amount of work for a toy project. So, like I said, it probably isn't 
really worth it. It's ultimately simpler to just use `raco distribute` and send 
the whole bundle to someone else. Yes, it is a bit clumsy for something so 
small, but it should at least work.

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to