diff --git a/collects/compiler/doc.txt b/collects/compiler/doc.txt index 87e83c8f81..e451bda94b 100644 --- a/collects/compiler/doc.txt +++ b/collects/compiler/doc.txt @@ -499,8 +499,18 @@ _embedr-sig.ss_ library provides the signature, _compiler:embed^_. start for a MrEd-based application is "@executable_path/../../../"; if #f is supplied, the executable's framework path is left as-is, otherwise - a relative path to a framework in the installation's "lib" - directory is converted to an absolute path + the original executable's path to a framework is + converted to an absolute path if it was relative + + _'dll-dir_ (Windows) - a string/path to a directory that + contains PLT DLLs needed by the executable, such as + "pltmzsch.dll", or a boolean; a path can be + relative to the executable; if #f is supplied, the path + is left as-is; if #t is supplied, the path is dropped + (so that the DLLs must be in the system directory or the + user's PATH); if no value is supplied the original + executable's path to DLLs is converted to an absolute + path if it was relative _'subsystem_ (Windows) - a symbol, either 'console for a console application or 'windows for a consoleless application; diff --git a/collects/compiler/embed-unit.ss b/collects/compiler/embed-unit.ss index 0c92811361..8005b027eb 100644 --- a/collects/compiler/embed-unit.ss +++ b/collects/compiler/embed-unit.ss @@ -12,7 +12,8 @@ "embed-sig.ss" "private/winicon.ss" "private/winsubsys.ss" - "private/macfw.ss") + "private/macfw.ss" + "private/windlldir.ss") (provide compiler:embed@) @@ -536,9 +537,9 @@ (let ([exe (find-exe mred? variant)]) (when verbose? (fprintf (current-error-port) "Copying to ~s~n" dest)) - (let-values ([(dest-exe osx?) + (let-values ([(dest-exe orig-exe osx?) (if (and mred? (eq? 'macosx (system-type))) - (values (prepare-macosx-mred exe dest aux variant) #t) + (values (prepare-macosx-mred exe dest aux variant) #f #t) (begin (when (or (file-exists? dest) (directory-exists? dest) @@ -549,7 +550,7 @@ ;; on Mac OS X, which is handles above. (delete-file dest)) (copy-file exe dest) - (values dest #f)))]) + (values dest exe #f)))]) (with-handlers ([void (lambda (x) (if osx? (when (directory-exists? dest) @@ -566,16 +567,27 @@ mred?)) ;; Check whether we need an absolute path to frameworks: (let ([dest (mac-dest->executable dest mred?)]) - (when (regexp-match #rx"^@executable_path" - (get-current-framework-path dest - (if mred? - "PLT_MrEd" - "PLT_MzScheme"))) - (update-framework-path (string-append - (path->string (build-path plthome "lib")) - "/") - dest - mred?)))))) + (when (regexp-match #rx"^@executable_path" + (get-current-framework-path dest + (if mred? + "PLT_MrEd" + "PLT_MzScheme"))) + (update-framework-path (string-append + (path->string (build-path plthome "lib")) + "/") + dest + mred?)))))) + (when (eq? 'windows (system-type)) + (let ([m (assq 'dll-dir aux)]) + (if m + (when (cdr m) + (update-dll-dir dest (cdr m))) + ;; Check whether we need an absolute path to DLLs: + (let ([dir (get-current-dll-dir dest)]) + (when (relative-path? dir) + (let-values ([(orig-dir name dir?) (split-path + (path->complete-path orig-exe))]) + (update-dll-dir dest (build-path orig-dir dir)))))))) (let ([start (file-size dest-exe)]) (with-output-to-file dest-exe (lambda () diff --git a/collects/compiler/private/windlldir.ss b/collects/compiler/private/windlldir.ss new file mode 100644 index 0000000000..acb7e0a93e --- /dev/null +++ b/collects/compiler/private/windlldir.ss @@ -0,0 +1,39 @@ + +(module windlldir mzscheme + (require (lib "port.ss")) + + (provide update-dll-dir + get-current-dll-dir) + + (define label "dLl dIRECTORy:") + (define max-dir-len 512) + + (define (update-dll-dir dest path) + (let ([path-bytes (if (eq? path #t) + #"" + (if (path? path) + (path->bytes path) + (string->bytes/locale path)))]) + (unless ((bytes-length path-bytes) . <= . max-dir-len) + (error 'update-dll-dir "path too long: ~e" path)) + (let ([m (with-input-from-file dest + (lambda () + (regexp-match-positions label (current-input-port))))]) + (unless m + (error 'update-ddl-dir "cannot find DLL path in file: ~e" dest)) + (with-output-to-file dest + (lambda () + (file-position (current-output-port) (cdar m)) + (write-bytes path-bytes) + (write-byte 0)) + 'update)))) + + + (define (get-current-dll-dir dest) + (with-input-from-file dest + (lambda () + (unless (regexp-match label (current-input-port)) + (error 'get-current-dll-dir "cannot find DLL path in file: ~e" dest)) + (let ([p (make-limited-input-port (current-input-port) max-dir-len)]) + (let ([m (regexp-match #rx#"[^\0]*" p)]) + (bytes->path (car m)))))))) diff --git a/collects/compiler/private/xform.ss b/collects/compiler/private/xform.ss index dc7b8153ce..5d9ed1179f 100644 --- a/collects/compiler/private/xform.ss +++ b/collects/compiler/private/xform.ss @@ -11,7 +11,8 @@ file-out palm? pgc? pgc-really? precompiling-header? precompiled-header - show-info? output-depends-info?) + show-info? output-depends-info? + gc-variable-stack-through-funcs?) (parameterize ([current-output-port (current-output-port)]) (begin-with-definitions (define power-inspector (current-inspector)) @@ -69,6 +70,8 @@ (define used-symbols (make-hash-table)) (hash-table-put! used-symbols (string->symbol "GC_variable_stack") 1) (hash-table-put! used-symbols (string->symbol "GC_cpp_delete") 1) + (hash-table-put! used-symbols (string->symbol "GC_get_variable_stack") 1) + (hash-table-put! used-symbols (string->symbol "GC_set_variable_stack") 1) (hash-table-put! used-symbols (string->symbol "memset") 1) ;; For dependency tracking: @@ -568,7 +571,7 @@ (define gc-var-stack-through-table? (ormap (lambda (e) (and (pragma? e) - (regexp-match #rx"GC_VARIABLE_SATCK_THOUGH_TABLE" (pragma-s e)))) + (regexp-match #rx"GC_VARIABLE_STACK_THOUGH_TABLE" (pragma-s e)))) e-raw)) ;; The code produced by xform uses a number of macros. These macros @@ -581,12 +584,20 @@ (printf (if gc-var-stack-through-table? "#define GC_VARIABLE_STACK (scheme_extension_table->GC_variable_stack)~n" "#define GC_VARIABLE_STACK GC_variable_stack~n")) + + (if gc-variable-stack-through-funcs? + (begin + (printf "#define GET_GC_VARIABLE_STACK() GC_get_variable_stack()\n") + (printf "#define SET_GC_VARIABLE_STACK(v) GC_set_variable_stack(v)\n")) + (begin + (printf "#define GET_GC_VARIABLE_STACK() GC_VARIABLE_STACK\n") + (printf "#define SET_GC_VARIABLE_STACK(v) (GC_VARIABLE_STACK = (v))\n"))) ;; Declare stack-registration record of a particular size: (printf (string-append - "#define PREPARE_VAR_STACK(size) void *__gc_var_stack__[size+2]; __gc_var_stack__[0] = GC_VARIABLE_STACK;" + "#define PREPARE_VAR_STACK(size) void *__gc_var_stack__[size+2]; __gc_var_stack__[0] = GET_GC_VARIABLE_STACK();" (if callee-restore? - " GC_VARIABLE_STACK = __gc_var_stack__;" + " SET_GC_VARIABLE_STACK(__gc_var_stack__);" "") "~n")) @@ -599,19 +610,19 @@ "#define SETUP(x) (" (if callee-restore? "" - "GC_VARIABLE_STACK = __gc_var_stack__, ") + "SET_GC_VARIABLE_STACK(__gc_var_stack__), ") "__gc_var_stack__[1] = (void *)x)~n")) ;; Call a function where the number of registered variables can change in ;; nested blocks: (printf "#define FUNCCALL_each(setup, x) (setup, x)~n") ;; The same, but a "tail" call: - (printf "#define FUNCCALL_EMPTY_each(x) FUNCCALL_each(GC_VARIABLE_STACK = (void **)__gc_var_stack__[0], x)~n") + (printf "#define FUNCCALL_EMPTY_each(x) FUNCCALL_each(SET_GC_VARIABLE_STACK((void **)__gc_var_stack__[0]), x)~n") ;; The same, but the number of registered variables for this call is definitely ;; the same as for the previous call: (printf (if callee-restore? "#define FUNCCALL_AGAIN_each(x) x~n" - "#define FUNCCALL_AGAIN_each(x) FUNCCALL_each(GC_VARIABLE_STACK = __gc_var_stack__, x)~n")) + "#define FUNCCALL_AGAIN_each(x) FUNCCALL_each(SET_GC_VARIABLE_STACK(__gc_var_stack__), x)~n")) ;; As above, but when the number of registered variables never changes ;; within a procedure: @@ -640,13 +651,13 @@ "#define RET_VALUE_START return (__ret__val__ = ~n" "#define RET_VALUE_START return~n")) (printf (if callee-restore? - "#define RET_VALUE_END , GC_VARIABLE_STACK = (void **)__gc_var_stack__[0], __ret__val__)~n" + "#define RET_VALUE_END , SET_GC_VARIABLE_STACK((void **)__gc_var_stack__[0]), __ret__val__)~n" "#define RET_VALUE_END ~n")) ;; Wrap a return where the value is produced by a FUNCCALL_EMPTY expression: (printf "#define RET_VALUE_EMPTY_START return~n") (printf "#define RET_VALUE_EMPTY_END ~n") ;; Replacement for non-value return: - (printf "#define RET_NOTHING { GC_VARIABLE_STACK = (void **)__gc_var_stack__[0]; return; }~n") + (printf "#define RET_NOTHING { SET_GC_VARIABLE_STACK((void **)__gc_var_stack__[0]); return; }~n") ;; A non-value return inserted at the end of a void-returning function: (printf "#define RET_NOTHING_AT_END RET_NOTHING~n") @@ -685,7 +696,7 @@ (printf "#define DELETE_ARRAY(x) (delete[] x)~n") (printf (if callee-restore? "#define XFORM_RESET_VAR_STACK /* empty */~n" - "#define XFORM_RESET_VAR_STACK GC_VARIABLE_STACK = (void **)__gc_var_stack__[0];~n")) + "#define XFORM_RESET_VAR_STACK SET_GC_VARIABLE_STACK((void **)__gc_var_stack__[0]);~n")) (unless pgc-really? (printf "#include \"cgc2.h\"~n")) diff --git a/collects/compiler/xform.ss b/collects/compiler/xform.ss index 703569f349..cf91a263ec 100644 --- a/collects/compiler/xform.ss +++ b/collects/compiler/xform.ss @@ -19,4 +19,5 @@ dest #f #t #t #f #f - #f #f)))) + #f #f + #f)))) diff --git a/collects/setup/setup-unit.ss b/collects/setup/setup-unit.ss index 772546d816..4aca692378 100644 --- a/collects/setup/setup-unit.ss +++ b/collects/setup/setup-unit.ss @@ -743,6 +743,7 @@ (let ([p (program-launcher-path mzln)] [aux (list* `(exe-name . ,mzln) '(framework-root . #f) + '(dll-dir . #f) '(relative? . #t) (build-aux-from-path (build-path (cc-path cc) diff --git a/src/mred/mrmain.cxx b/src/mred/mrmain.cxx index c0471832f3..8e47f075e7 100644 --- a/src/mred/mrmain.cxx +++ b/src/mred/mrmain.cxx @@ -533,20 +533,12 @@ static char *CreateUniqueName() return together; } -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR ignored, int nCmdShow) +int APIENTRY WinMain_dlls_ready(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR ignored, int nCmdShow) { LPWSTR m_lpCmdLine; long argc, j, l; char *a, **argv, *b, *normalized_path = NULL; - /* Order matters: load dependencies first */ -# ifndef MZ_PRECISE_GC - load_delayed_dll("libmzgcxxxxxxx.dll"); -# endif - load_delayed_dll("libmzsch" DLL_3M_SUFFIX "xxxxxxx.dll"); - load_delayed_dll("libmred" DLL_3M_SUFFIX "xxxxxxx.dll"); - record_dll_path(); - /* Get command line: */ m_lpCmdLine = GetCommandLineW(); for (j = 0; m_lpCmdLine[j]; j++) { @@ -633,4 +625,25 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR ignored return wxWinMain(wm_is_mred, hInstance, hPrevInstance, argc, argv, nCmdShow, main); } +# ifdef MZ_PRECISE_GC +START_XFORM_SKIP; +# endif + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR ignored, int nCmdShow) +{ + /* Order matters: load dependencies first */ +# ifndef MZ_PRECISE_GC + load_delayed_dll("libmzgcxxxxxxx.dll"); +# endif + load_delayed_dll("libmzsch" DLL_3M_SUFFIX "xxxxxxx.dll"); + load_delayed_dll("libmred" DLL_3M_SUFFIX "xxxxxxx.dll"); + record_dll_path(); + + return WinMain_dlls_ready(hInstance, hPrevInstance, ignored, nCmdShow); +} + +# ifdef MZ_PRECISE_GC +END_XFORM_SKIP; +# endif + #endif diff --git a/src/mzscheme/cmdline.inc b/src/mzscheme/cmdline.inc index b1faed9597..64f58f2899 100644 --- a/src/mzscheme/cmdline.inc +++ b/src/mzscheme/cmdline.inc @@ -41,12 +41,16 @@ static int _coldir_offset = 19; /* Skip permanent tag */ # define DLL_3M_SUFFIX "" # endif static char *_dlldir = "dLl dIRECTORy:" /* <- this tag stays, so we can find it again */ - ""; + "lib\0" + /* Pad with 512 bytes: */ + "****************************************************************" + "****************************************************************" + "****************************************************************" + "****************************************************************" + "****************************************************************" + "****************************************************************" + "****************************************************************" + "****************************************************************"; static int _dlldir_offset = 14; /* Skip permanent tag */ # ifdef MZ_PRECISE_GC diff --git a/src/mzscheme/gc2/compact.c b/src/mzscheme/gc2/compact.c index df74788313..758207dde0 100644 --- a/src/mzscheme/gc2/compact.c +++ b/src/mzscheme/gc2/compact.c @@ -154,6 +154,9 @@ void (*GC_fixup_xtagged)(void *obj); void **GC_variable_stack; +void **GC_get_variable_stack() { return GC_variable_stack; } +void GC_set_variable_stack(void **p) { GC_variable_stack = p; } + /********************* Type tags *********************/ Type_Tag weak_box_tag = 42; /* set by client */ Type_Tag ephemeron_tag = 42; /* set by client */ diff --git a/src/mzscheme/gc2/gc2.h b/src/mzscheme/gc2/gc2.h index 14e731b282..59b94280b2 100644 --- a/src/mzscheme/gc2/gc2.h +++ b/src/mzscheme/gc2/gc2.h @@ -225,6 +225,9 @@ GC2_EXTERN void **GC_variable_stack; /* See the general overview in README. */ +GC2_EXTERN void **GC_get_variable_stack(); +GC2_EXTERN void GC_set_variable_stack(void **p); + GC2_EXTERN void GC_register_traversers(short tag, Size_Proc size, Mark_Proc mark, Fixup_Proc fixup, int is_constant_size, int is_atomic); /* diff --git a/src/mzscheme/gc2/newgc.c b/src/mzscheme/gc2/newgc.c index eb56774989..536863f075 100644 --- a/src/mzscheme/gc2/newgc.c +++ b/src/mzscheme/gc2/newgc.c @@ -653,6 +653,16 @@ void **GC_variable_stack; static unsigned long stack_base; static void *park[2]; +void **GC_get_variable_stack() +{ + return GC_variable_stack; +} + +void GC_set_variable_stack(void **p) +{ + GC_variable_stack = p; +} + void GC_set_stack_base(void *base) { stack_base = (unsigned long)base; diff --git a/src/mzscheme/gc2/xform-mod.ss b/src/mzscheme/gc2/xform-mod.ss index 9521d3e08a..303bfa8b3a 100644 --- a/src/mzscheme/gc2/xform-mod.ss +++ b/src/mzscheme/gc2/xform-mod.ss @@ -7,6 +7,7 @@ (define show-info? #f) (define output-depends-info? #f) + (define gc-variable-stack-through-funcs? #f) (define palm? #f) (define pgc? #t) @@ -41,6 +42,8 @@ (set! cpp cmdline)] [("-o") dest-file "name destination file" (set! file-out dest-file)] + [("--indirect") "access GC_variable_stack through functions" + (set! gc-variable-stack-through-funcs? #t)] [("+D") def "add CPP -D flag" (set! cpp (string-append cpp " -D" (regexp-replace* "[ \"]" def "'\\0'")))]] @@ -52,7 +55,8 @@ file-out palm? pgc? pgc-really? precompiling-header? precompiled-header - show-info? output-depends-info?)) + show-info? output-depends-info? + gc-variable-stack-through-funcs?)) diff --git a/src/mzscheme/main.c b/src/mzscheme/main.c index ecb2c76a57..2ed612a505 100644 --- a/src/mzscheme/main.c +++ b/src/mzscheme/main.c @@ -226,16 +226,16 @@ int actual_main(int argc, char *argv[]); #endif /***************************** main ********************************/ -/* Phase 1 setup, then call actual_main (indirectly) */ +/* Prepare for delayload, then call main_after_dlls */ + +static int main_after_dlls(int argc, MAIN_char **MAIN_argv); + +# ifdef MZ_PRECISE_GC +START_XFORM_SKIP; +# endif int MAIN(int argc, MAIN_char **MAIN_argv) { - void *stack_start; - int rval; -#ifdef WINDOWS_UNICODE_MAIN - char **argv; -#endif - #ifdef DOS_FILE_SYSTEM /* Order matters: load dependencies first */ # ifndef MZ_PRECISE_GC @@ -245,6 +245,24 @@ int MAIN(int argc, MAIN_char **MAIN_argv) record_dll_path(); #endif + return main_after_dlls(argc, MAIN_argv); +} + +# ifdef MZ_PRECISE_GC +END_XFORM_SKIP; +# endif + +/************************ main_after_dlls **************************/ +/* Phase 1 setup, then call actual_main (indirectly) */ + +static int main_after_dlls(int argc, MAIN_char **MAIN_argv) +{ + void *stack_start; + int rval; +#ifdef WINDOWS_UNICODE_MAIN + char **argv; +#endif + stack_start = (void *)&stack_start; #if defined(MZ_PRECISE_GC) diff --git a/src/worksp-vc70/libmred/libmred.vcproj b/src/worksp-vc70/libmred/libmred.vcproj index 144fb46acc..9fce75e0fc 100644 --- a/src/worksp-vc70/libmred/libmred.vcproj +++ b/src/worksp-vc70/libmred/libmred.vcproj @@ -34,7 +34,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="ComCtl32.lib Glu32.lib OpenGL32.lib Unicows.lib WinMM.lib WSock32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Advapi32.lib Ole32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x11000000" @@ -84,7 +84,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="ComCtl32.lib Glu32.lib OpenGL32.lib Unicows.lib WinMM.lib WSock32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Advapi32.lib Ole32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x11000000" diff --git a/src/worksp-vc70/libmzgc/libmzgc.vcproj b/src/worksp-vc70/libmzgc/libmzgc.vcproj index 027ef1f760..369e84b94e 100644 --- a/src/worksp-vc70/libmzgc/libmzgc.vcproj +++ b/src/worksp-vc70/libmzgc/libmzgc.vcproj @@ -36,7 +36,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" ImportLibrary="..\..\..\lib\msvc\$(ProjectName)xxxxxxx.lib"/> @@ -87,7 +87,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" ImportLibrary="..\..\..\lib\msvc\$(ProjectName)xxxxxxx.lib"/> diff --git a/src/worksp-vc70/libmzsch/libmzsch.vcproj b/src/worksp-vc70/libmzsch/libmzsch.vcproj index 96951bdd95..29298d0544 100644 --- a/src/worksp-vc70/libmzsch/libmzsch.vcproj +++ b/src/worksp-vc70/libmzsch/libmzsch.vcproj @@ -37,7 +37,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib WSock32.lib Shell32.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x10400000" @@ -90,7 +90,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib WSock32.lib Shell32.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x10400000" diff --git a/src/worksp/gc2/make.ss b/src/worksp/gc2/make.ss index 974117acc4..eb71af5ef0 100644 --- a/src/worksp/gc2/make.ss +++ b/src/worksp/gc2/make.ss @@ -55,7 +55,7 @@ "type" "vector")) -(define (try src deps dest objdest includes use-precomp extra-compile-flags expand-extra-flags msvc-pch) +(define (try src deps dest objdest includes use-precomp extra-compile-flags expand-extra-flags msvc-pch indirect?) (when (or (not re:only) (regexp-match re:only dest)) (unless (and (file-exists? dest) (let ([t (file-or-directory-modify-seconds dest)]) @@ -84,6 +84,9 @@ (list "--precompiled" use-precomp) null) (list "--precompile")) + (if indirect? + '("--indirect") + null) (list "--depends" "--cpp" @@ -126,7 +129,7 @@ common-deps) "xsrc/precomp.h" #f (string-append mz-inc "/I ../../mzscheme/src") - #f "" "" #f) + #f "" "" #f #f) (for-each (lambda (x) @@ -139,7 +142,8 @@ "xsrc/precomp.h" "" "/D LIBMZ_EXPORTS " - "mz.pch")) + "mz.pch" + #f)) srcs) (try "../../mzscheme/main.c" @@ -151,7 +155,8 @@ #f "" "" - #f) + #f + #t) (try "../../foreign/foreign.c" (list* "../../foreign/foreign.c" @@ -165,6 +170,7 @@ #f "" "" + #f #f) (compile "../../mzscheme/gc2/gc2.c" "xsrc/gc2.obj" @@ -183,7 +189,7 @@ mz-inc)) (compile "../../mzscheme/src/mzsj86.c" "xsrc/mzsj86.obj" '() mz-inc) -(define dll "../../../libmzsch3mxxxxxxx.dll") +(define dll "../../../lib/libmzsch3mxxxxxxx.dll") (define exe "../../../MzScheme3m.exe") (define libs "kernel32.lib user32.lib wsock32.lib shell32.lib advapi32.lib") @@ -197,7 +203,7 @@ (> (file-or-directory-modify-seconds f) ms)) objs) - (unless (system- (format "cl.exe ~a /MT /Zi /Fe~a unicows.lib ~a ~a ~a ~a" + (unless (system- (format "cl.exe ~a /MT /Zi /Fe~a unicows.lib ~a ~a /link ~a~a~a" (if exe? "" "/LD /DLL") dll (let loop ([objs (append objs sys-libs)]) @@ -207,16 +213,21 @@ (car objs) " " (loop (cdr objs))))) + libs (let loop ([delayloads delayloads]) (if (null? delayloads) "" (string-append - "/DELAYLOAD:" + " /DELAYLOAD:" (car delayloads) " " (loop (cdr delayloads))))) - libs - link-options)) + link-options + (let ([s (regexp-match "^(.*)/([a-z0-9]*)[.]dll$" dll)]) + (if s + (format " /IMPLIB:~a/msvc/~a.lib" + (cadr s) (caddr s)) + "")))) (error 'winmake "~a link failed" (if exe? "EXE" "DLL")))))) (let ([objs (list* @@ -238,10 +249,11 @@ (let ([objs (list "xsrc/main.obj" "../mzscheme/Release/uniplt.obj" - "../../../libmzsch3mxxxxxxx.lib")]) + "../../../lib/msvc/libmzsch3mxxxxxxx.lib")]) (link-dll objs - '("msvcrt71.dll" "libmzsch3mxxxxxxx.lib") - null exe "" #t)) + '("libmzsch3mxxxxxxx.dll") + '("delayimp.lib") + exe "" #t)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -255,9 +267,9 @@ "/I ../../wxWindow/contrib/fafa " "/I ../../wxcommon/jpeg /I ../jpeg /I ../../wxcommon/zlib ")) (try "wxprecomp.cxx" (list* "../../mzscheme/src/schvers.h" common-deps) - "xsrc/wxprecomp.h" #f wx-inc #f "" "-DGC2_AS_IMPORT" #f) + "xsrc/wxprecomp.h" #f wx-inc #f "" "-DGC2_AS_IMPORT" #f #f) -(define (wx-try base proj x use-precomp? suffix) +(define (wx-try base proj x use-precomp? suffix indirect?) (let ([cxx-file (format "../../~a/~a.~a" base x suffix)]) (try cxx-file (list* cxx-file @@ -268,7 +280,8 @@ (and use-precomp? "xsrc/wxprecomp.h") "-DGC2_JUST_MACROS /FI../../../mzscheme/gc2/gc2.h" "-DGC2_AS_IMPORT" - "wx.pch"))) + "wx.pch" + indirect?))) (define wxwin-base-srcs '("wb_canvs" @@ -294,7 +307,7 @@ "wb_win")) (map (lambda (x) - (wx-try "wxwindow/src/base" "wxwin" x #t "cxx")) + (wx-try "wxwindow/src/base" "wxwin" x #t "cxx" #f)) wxwin-base-srcs) (define wxwin-msw-srcs @@ -327,7 +340,7 @@ "wximgfil")) (map (lambda (x) - (wx-try "wxwindow/src/msw" "wxwin" x #t "cxx")) + (wx-try "wxwindow/src/msw" "wxwin" x #t "cxx" #f)) wxwin-msw-srcs) (define wxs-srcs @@ -362,7 +375,7 @@ "wxscheme")) (map (lambda (x) - (wx-try "mred/wxs" "wxs" x #t "cxx")) + (wx-try "mred/wxs" "wxs" x #t "cxx" #f)) wxs-srcs) (define wxme-srcs @@ -380,7 +393,7 @@ "wx_style")) (map (lambda (x) - (wx-try "mred/wxme" "wxme" x #t "cxx")) + (wx-try "mred/wxme" "wxme" x #t "cxx" #f)) wxme-srcs) (define mred-srcs @@ -388,11 +401,11 @@ "mredmsw")) (map (lambda (x) - (wx-try "mred" "libmred" x #t "cxx")) + (wx-try "mred" "libmred" x #t "cxx" #f)) mred-srcs) -(wx-try "wxcommon" "wxme" "wxJPEG" #t "cxx") -(wx-try "mzscheme/utils" "wxme" "xcglue" #f "c") +(wx-try "wxcommon" "wxme" "wxJPEG" #t "cxx" #f) +(wx-try "mzscheme/utils" "wxme" "xcglue" #f "c" #f) (compile "../../wxcommon/wxGC.cxx" "xsrc/wxGC.obj" (list "../wxme/Release/wxGC.obj") @@ -412,7 +425,7 @@ wxme-srcs mred-srcs)))] [libs (list - "../../../libmzsch3mxxxxxxx.lib" + "../../../lib/msvc/libmzsch3mxxxxxxx.lib" "../wxutils/Release/wxutils.lib" "../jpeg/Release/jpeg.lib" "../png/Release/png.lib" @@ -422,9 +435,9 @@ "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "winmm.lib")]) - (link-dll (append objs libs) null win-libs "../../../libmred3mxxxxxxx.dll" "" #f)) + (link-dll (append objs libs) null win-libs "../../../lib/libmred3mxxxxxxx.dll" "" #f)) -(wx-try "mred" "mred" "mrmain" #f "cxx") +(wx-try "mred" "mred" "mrmain" #f "cxx" #t) (unless (file-exists? "mred.res") (system- (string-append @@ -435,11 +448,14 @@ "mred.res" "xsrc/mrmain.obj" "../mred/Release/uniplt.obj" - "../../../libmzsch3mxxxxxxx.lib" - "../../../libmred3mxxxxxxx.lib")]) + "../../../lib/msvc/libmzsch3mxxxxxxx.lib" + "../../../lib/msvc/libmred3mxxxxxxx.lib")]) (link-dll objs - '("msvcrt71.dll" "libmzsch3mxxxxxxx.lib" "libmred3mxxxxxxx.lib") - (list "advapi32.lib") "../../../MrEd3m.exe" "/link /subsystem:windows" #t)) + '("libmzsch3mxxxxxxx.dll" + "libmred3mxxxxxxx.dll") + '("advapi32.lib" + "delayimp.lib") + "../../../MrEd3m.exe" " /subsystem:windows" #t)) (system- "cl.exe /MT /O2 /DMZ_PRECISE_GC /I../../mzscheme/include /I.. /c ../../mzscheme/dynsrc/mzdyn.c /Fomzdyn3m.obj") (system- "lib.exe -def:../../mzscheme/dynsrc/mzdyn.def -out:mzdyn3m.lib") @@ -454,4 +470,4 @@ (copy-file/diff "mzdyn3m.exp" "../../../lib/msvc/mzdyn3m.exp") (copy-file/diff "mzdyn3m.obj" "../../../lib/msvc/mzdyn3m.obj") -(copy-file/diff "../../../libmzsch3mxxxxxxx.lib" "../../../lib/msvc/libmzsch3mxxxxxxx.lib") + diff --git a/src/worksp/libmred/libmred.vcproj b/src/worksp/libmred/libmred.vcproj index a1cf29ca2b..72903521f7 100644 --- a/src/worksp/libmred/libmred.vcproj +++ b/src/worksp/libmred/libmred.vcproj @@ -36,7 +36,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="ComCtl32.lib Glu32.lib OpenGL32.lib Unicows.lib WinMM.lib WSock32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Advapi32.lib Ole32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x11000000" @@ -94,7 +94,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="ComCtl32.lib Glu32.lib OpenGL32.lib Unicows.lib WinMM.lib WSock32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Advapi32.lib Ole32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x11000000" diff --git a/src/worksp/libmzgc/libmzgc.vcproj b/src/worksp/libmzgc/libmzgc.vcproj index 9d74aff689..c0c4b8920a 100644 --- a/src/worksp/libmzgc/libmzgc.vcproj +++ b/src/worksp/libmzgc/libmzgc.vcproj @@ -36,7 +36,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" ImportLibrary="..\..\..\lib\msvc\$(ProjectName)xxxxxxx.lib"/> @@ -93,7 +93,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" ImportLibrary="..\..\..\lib\msvc\$(ProjectName)xxxxxxx.lib"/> diff --git a/src/worksp/libmzsch/libmzsch.vcproj b/src/worksp/libmzsch/libmzsch.vcproj index 7f08973b4e..4915567e59 100644 --- a/src/worksp/libmzsch/libmzsch.vcproj +++ b/src/worksp/libmzsch/libmzsch.vcproj @@ -37,7 +37,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib WSock32.lib Shell32.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x10400000" @@ -96,7 +96,7 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="Unicows.lib WSock32.lib Shell32.lib User32.lib" - OutputFile="..\..\..\$(ProjectName)xxxxxxx.dll" + OutputFile="..\..\..\lib\$(ProjectName)xxxxxxx.dll" SuppressStartupBanner="TRUE" GenerateDebugInformation="TRUE" BaseAddress="0x10400000"