I've added a `--runtime <dir>` argument to `raco ctool --cmods`, which
gathers runtime files into <dir> and makes the embedded modules refer
to them in <dir> (which is expected to be relative to the executable,
but see also the `--runtime-access` option).

The embedding executable must call scheme_set_exec_cmd() to set the
result of `(find-system-path 'exec-file)` so that runtime files can be
found in <dir> relative to the executable.

At Wed, 16 Sep 2015 07:52:11 -0600, Matthew Flatt wrote:
> After thinking about this more, it looks more promising to extend `raco
> ctool --cmods` so that it can do a `raco distribute`-like step in
> addition to a `raco exe`-like step.
> 
> In other words, `raco ctool --cmods` with some extra flag could give
> you both a file (as currently, to embed in the executable) and a
> directory of extra files (that are referenced through relative paths by
> the part to embed).
> 
> Still, I'll have to try that out to see if it works.
> 
> At Wed, 16 Sep 2015 16:11:21 +0300, Dmitry Pavlov wrote:
> > Also, if it matters, I usually make my Windows builds on Linux
> > with MinGW (i686-w64-mingw32-gcc, x86_64-w64-mingw32). But I can
> > use Visual Studio too, I guess, if that will make things easier
> > for raco distribute or whatever.
> > 
> > Best regards,
> > 
> > Dmitry
> > 
> > 
> > On 09/16/2015 03:52 PM, Dmitry Pavlov wrote:
> > > Matthew,
> > >
> > >> The most likely solution is to make the executable look enough like a
> > >> "PLT executable", but I'll have to try it out to pin down additions
> > >> that will work.
> > >>
> > >> Are you interested in this only for Unix variants or for all platforms?
> > >> I think Windows will be more difficult.
> > >
> > > Thank you for the reply.
> > >
> > > Not only I need this for both Windows and Linux, but ideally
> > > in the future I would like to ship also a dynamic C library that
> > > uses a Racket library that has runtime paths. For the start,
> > > though, Windows and Linux executables will be enough for my purposes.
> > >
> > > Also, if it matters, my Racket library uses some low-level C
> > > libraries itself.
> > >
> > > I can not estimate the difficulty of either approach to this problem,
> > > but I am entirely open to solutions that require some special
> > > handling from the C level --- hijacking runtime paths from C maybe?
> > > I do not know.
> > >
> > > Best regards,
> > >
> > > Dmitry
> > >
> > >>
> > >> At Wed, 16 Sep 2015 14:26:41 +0300, Dmitry Pavlov wrote:
> > >>> Hello,
> > >>>
> > >>> I just created a C program that uses my Racket library via
> > >>> Racket's embedding mechanism, and it works fantastic.
> > >>>
> > >>> Now I am wondering---how to ship my C program's
> > >>> executable if the underlying Racket library has runtime
> > >>> paths in it? The executable seems to have been set up for
> > >>> absolute paths of the runtime paths that Racket library uses.
> > >>>
> > >>> I know that for pure Racket programs, raco distribute
> > >>> does the job of handling the paths and shipping the program
> > >>> with all the needed files. I tried (maybe too naively)
> > >>> to apply raco distribute to my executable, and got the following:
> > >>>
> > >>> assemble-distribution: file is not a PLT executable
> > >>>
> > >>> OK, maybe it is not. But what other options do I have?
> > >>> FWIW, I used the following commands to create the executable:
> > >>>
> > >>> raco ctool --c-mods base.c ++lib my-library
> > >>>
> > >>> gcc -c -g -DMZ_PRECISE_GC -I/opt/racket/include -o main.o main.c
> > >>>
> > >>> gcc -o myprog main.o -lpthread -lm -ldl /opt/racket/lib/libracket3m.a
> > >>> -rdynamic
> > >>>
> > >>> the contents of main.c for the most part copies the example
> > >>> at http://docs.racket-lang.org/inside/embedding.html
> > >>>
> > >>>
> > >>> Best regards,
> > >>>
> > >>> Dmitry
> > >>>
> > >>> --
> > >>> 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.
> > >
> > 
> > -- 
> > 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.
> 
> -- 
> 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.

-- 
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