diff --git a/otherlibs/labltk/browser/Makefile.nt b/otherlibs/labltk/browser/Makefile.nt index 12550fe8cb0d..2c7cb8cb48e5 100644 --- a/otherlibs/labltk/browser/Makefile.nt +++ b/otherlibs/labltk/browser/Makefile.nt @@ -3,12 +3,13 @@ OTHERSLIB=-I $(OTHERS)/win32unix -I $(OTHERS)/str -I $(OTHERS)/systhreads CCFLAGS=-I../../../byterun $(TK_DEFS) ifeq ($(CCOMPTYPE),cc) -WINDOWS_APP=-ccopt "-Wl,--subsystem,windows" +WINDOWS_APP=-ccopt "-link -Wl,--subsystem,windows" else -WINDOWS_APP=-ccopt "/link /subsystem:windows" +WINDOWS_APP=-ccopt "-link /subsystem:windows" endif -OCAMLBR=threads.cma winmain.$(O) $(WINDOWS_APP) +XTRAOBJ=winmain.$(O) +XTRALIBS=threads.cma -custom $(WINDOWS_APP) include Makefile.shared diff --git a/otherlibs/labltk/browser/Makefile.shared b/otherlibs/labltk/browser/Makefile.shared index c5080b7cf114..74d83a949c43 100644 --- a/otherlibs/labltk/browser/Makefile.shared +++ b/otherlibs/labltk/browser/Makefile.shared @@ -30,10 +30,11 @@ JG = jg_tk.cmo jg_config.cmo jg_bind.cmo jg_completion.cmo \ all: ocamlbrowser$(EXE) ocamlbrowser$(EXE): $(TOPDIR)/toplevel/toplevellib.cma jglib.cma $(OBJ) \ - ../support/lib$(LIBNAME).$(A) - $(CAMLC) -o ocamlbrowser$(EXE) $(INCLUDES) \ + ../support/lib$(LIBNAME).$(A) $(XTRAOBJ) + $(CAMLC) -verbose -o ocamlbrowser$(EXE) $(INCLUDES) \ $(TOPDIR)/toplevel/toplevellib.cma \ - unix.cma str.cma $(OCAMLBR) $(LIBNAME).cma jglib.cma $(OBJ) + unix.cma str.cma $(XTRALIBS) $(LIBNAME).cma jglib.cma \ + $(OBJ) $(XTRAOBJ) ocamlbrowser.cma: jglib.cma $(OBJ) $(CAMLC) -a -o $@ -linkall jglib.cma $(OBJ) diff --git a/otherlibs/labltk/browser/winmain.c b/otherlibs/labltk/browser/winmain.c index b647fb79b7ca..2eb32e67f778 100644 --- a/otherlibs/labltk/browser/winmain.c +++ b/otherlibs/labltk/browser/winmain.c @@ -3,16 +3,22 @@ #include #include -CAMLextern int __argc; -CAMLextern char **__argv; -CAMLextern void caml_expand_command_line(int * argcp, char *** argvp); +/*CAMLextern int __argc; */ +/* CAMLextern char **__argv; */ +/* CAMLextern void caml_expand_command_line(int * argcp, char *** argvp); */ /* extern void caml_main (char **); */ int WINAPI WinMain(HINSTANCE h, HINSTANCE HPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - caml_expand_command_line(&__argc, &__argv); - caml_main(__argv); + char exe_name[1024]; + char * argv[2]; + + GetModuleFileName(NULL, exe_name, sizeof(exe_name) - 1); + exe_name[sizeof(exe_name) - 1] = '0'; + argv[0] = exe_name; + argv[1] = NULL; + caml_main(argv); sys_exit(Val_int(0)); return 0; }