Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] ocamlopt, windows, and no console
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-04-11 (17:19)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] ocamlopt, windows, and no console
One other option is to change the startup mode of the executable after
compiling and linking it. I did this years ago with <cough> Visual Basic to
make true console applications (the reverse of your problem). I can't find
the code archive, but IIRC it involves changing a single byte in the PE
header that indicates the subsystem to use. The concept of main and winmain
come entirely from C - the actual entry point of your image is independent
of its subsystem so this gets around your linking problem.

I can't get at the machine with the archive of the tool I wrote for doing
this at the moment <sigh>. However, Microsoft have some utilities for doing
this although I don't know whether they will only work for programs
generated with their compiliers - google for Visual Basic's Link utility and
MSVC++'s editbin tool.

Hope this helps,


-----Original Message-----
[] On Behalf Of Jonathan Roewen
Sent: 11 April 2006 04:08
To: Dmitry Bely
Subject: Re: [Caml-list] ocamlopt, windows, and no console

> I guess I'd have to provide a .c file which wraps ocaml's main
> procedure then, which probably isn't too hard. Which then leads me to
> requesting an option for the ocamlopt compiler for windows to have an
> option to do this all automatically.

And back to the task at hand: how do I specify a .lib file on the
command line to get this all to link? I can't figure out the
cclib/ccopt options to pass to ocamlopt =/


Caml-list mailing list. Subscription management:
Beginner's list:
Bug reports: