Skip to content

Commit

Permalink
Under Win32, build ocamlbrowser.exe as a Windows app, not a console a…
Browse files Browse the repository at this point in the history
…pp. To be tested under mingw.

git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.11@9135 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Nov 19, 2008
1 parent ee0fbdf commit db8457e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
7 changes: 4 additions & 3 deletions otherlibs/labltk/browser/Makefile.nt
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions otherlibs/labltk/browser/Makefile.shared
Expand Up @@ -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)
Expand Down
16 changes: 11 additions & 5 deletions otherlibs/labltk/browser/winmain.c
Expand Up @@ -3,16 +3,22 @@
#include <callback.h>
#include <sys.h>

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

0 comments on commit db8457e

Please sign in to comment.