From fb1432e70e00355eabbfae9809d2546a87a3ccbf Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 13 Nov 2015 06:49:07 -0700 Subject: [PATCH] declare and document scheme_set_dll_path() for Windows embedding --- .../scribblings/inside/embedding.scrbl | 23 +++++++++++++++---- .../racket-doc/scribblings/inside/hooks.scrbl | 9 ++++++++ pkgs/racket-doc/scribblings/inside/utils.rkt | 6 ++++- racket/src/racket/cmdline.inc | 2 -- racket/src/racket/include/scheme.h | 3 +++ 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/pkgs/racket-doc/scribblings/inside/embedding.scrbl b/pkgs/racket-doc/scribblings/inside/embedding.scrbl index 96c0c58433..f9ace6984e 100644 --- a/pkgs/racket-doc/scribblings/inside/embedding.scrbl +++ b/pkgs/racket-doc/scribblings/inside/embedding.scrbl @@ -1,5 +1,6 @@ #lang scribble/doc -@(require "utils.rkt") +@(require "utils.rkt" + scribble/bnf) @(define cgc-v-3m "CGC versus 3m") @@ -114,16 +115,28 @@ To embed Racket CGC in a program, follow these steps: into the top-level environment. To embed a module like @racketmodname[racket/base] (along with all - its dependencies), use @exec{raco ctool --c-mods}, which generates a C file + its dependencies), use + @seclink["c-mods" #:doc raco-doc]{@exec{raco ctool --c-mods @nonterm{dest}}}, + which generates a C file @nonterm{dest} that contains modules in bytecode form as encapsulated in a static array. The generated C file defines a @cppi{declare_modules} function that takes a @cpp{Scheme_Env*}, installs the modules into the environment, and adjusts the module name resolver to access the - embedded declarations. + embedded declarations. If embedded modules refer to runtime files + that need to be carried along, supply @DFlag{runtime} to + @exec{raco ctool --c-mods} to collect the runtime files into a + directory; see @secref[#:doc raco-doc "c-mods"] for more information. - Alternately, use @cpp{scheme_set_collects_path} and + Alternatively, use @cpp{scheme_set_collects_path} and @cpp{scheme_init_collection_paths} to configure and install a path - for finding modules at run time.} + for finding modules at run time. + + On Windows, @exec{raco ctool --c-mods @nonterm{dest} --runtime + @nonterm{dest-dir}} includes in @nonterm{dest-dir} optional DLLs + that are referenced by the Racket library to support @tech[#:doc + reference-doc]{extflonums} and @racket[bytes-open-converter]. Call + @cpp{scheme_set_dll_path} to register @nonterm{dest-dir} so that + those DLLs can be found at run time.} @item{Access Racket through @cppi{scheme_dynamic_require}, @cppi{scheme_load}, @cppi{scheme_eval}, and/or other functions diff --git a/pkgs/racket-doc/scribblings/inside/hooks.scrbl b/pkgs/racket-doc/scribblings/inside/hooks.scrbl index eb6a5ec9c3..774312abbd 100644 --- a/pkgs/racket-doc/scribblings/inside/hooks.scrbl +++ b/pkgs/racket-doc/scribblings/inside/hooks.scrbl @@ -91,6 +91,15 @@ Like @cpp{scheme_init_collection_paths_post}, but with @racket[null] as the last argument.} +@function[(void scheme_set_dll_path + [wchar_t* path])]{ + +On Windows only, sets the path used to find optional DLLs that are used +by the runtime system: @filepath{longdouble.dll} and one of @filepath{iconv.dll}, +@filepath{libiconv.dll}, or @filepath{libiconv-2.dll}. The given @var{path} +should be an absolute path.} + + @function[(void scheme_seal_parameters)]{ Takes a snapshot of the current values of built-in parameters. These diff --git a/pkgs/racket-doc/scribblings/inside/utils.rkt b/pkgs/racket-doc/scribblings/inside/utils.rkt index 47f9341272..50e99dfbe4 100644 --- a/pkgs/racket-doc/scribblings/inside/utils.rkt +++ b/pkgs/racket-doc/scribblings/inside/utils.rkt @@ -12,6 +12,7 @@ function subfunction FormatD tech-place + reference-doc raco-doc (except-out (all-from-out scribble/manual) var) (for-label (all-from-out scheme/base))) @@ -157,8 +158,11 @@ (define mzc (exec "raco ctool")) +(define reference-doc '(lib "scribblings/reference/reference.scrbl")) +(define raco-doc '(lib "scribblings/raco/raco.scrbl")) + (define (refsecref s) - (secref #:doc '(lib "scribblings/reference/reference.scrbl") s)) + (secref #:doc reference-doc s)) (define Racket (other-manual '(lib "scribblings/reference/reference.scrbl"))) diff --git a/racket/src/racket/cmdline.inc b/racket/src/racket/cmdline.inc index 0d56b56019..ba53a222b3 100644 --- a/racket/src/racket/cmdline.inc +++ b/racket/src/racket/cmdline.inc @@ -106,8 +106,6 @@ static void (*console_printf)(char *str, ...); # define PRINTF console_printf #endif -MZ_EXTERN void scheme_set_dll_path(wchar_t *s); - static void record_dll_path(void) { if (_dlldir[_dlldir_offset] != '<') { diff --git a/racket/src/racket/include/scheme.h b/racket/src/racket/include/scheme.h index eda74a245d..cd3bc38abf 100644 --- a/racket/src/racket/include/scheme.h +++ b/racket/src/racket/include/scheme.h @@ -1946,6 +1946,9 @@ MZ_EXTERN void scheme_set_addon_dir(Scheme_Object *p); MZ_EXTERN void scheme_set_command_line_arguments(Scheme_Object *vec); MZ_EXTERN void scheme_set_compiled_file_paths(Scheme_Object *list); MZ_EXTERN void scheme_set_compiled_file_roots(Scheme_Object *list); +#ifdef DOS_FILE_SYSTEM +MZ_EXTERN void scheme_set_dll_path(wchar_t *s); +#endif MZ_EXTERN void scheme_init_collection_paths(Scheme_Env *global_env, Scheme_Object *extra_dirs); MZ_EXTERN void scheme_init_collection_paths_post(Scheme_Env *global_env, Scheme_Object *extra_dirs, Scheme_Object *extra_post_dirs);