Loading ...
Sorry, an error occurred while loading the content.

3001Re: "ocaml_beginners"::[] Compiling Native on Windows 2000

Expand Messages
  • Tony Edgin
    Mar 1, 2005
      On Sun, 27 Feb 2005 22:44, Richard Jones wrote:
      > On Sun, Feb 27, 2005 at 01:21:21PM +1300, Tony Edgin wrote:
      > > I have Visual C++ 2005 Express Edition Beta installed. It contains the
      > > VC++ compiler cl.exe and the MASM assembler ml.exe. According to the
      > > OCaml documentation this should be all I need, but when I execute
      > > ocamlopt, I get the following linker error.
      > >
      > > LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
      > > Error during linking.
      >
      > The OCaml documentation is misleading - CL.EXE, and by extension
      > ocamlopt, requires a bunch of libraries for linking on Windows. I
      > suspect that the free version of VC++ you're using doesn't include all
      > the libraries, which is why you're getting the error.
      >
      > However all might not be lost. It is possible to tell VC++ not to
      > link with some of its default libraries, and (assuming the symbols in
      > those libraries aren't really needed) this might work. The way to do
      > this is to try passing:
      >
      > -ccopt "-link /nodefaultlib:advapi32.lib"
      >
      > on the ocamlopt linking command line (NB the quotes).

      This didn't work, but it gave me some insight into the problem. After
      browsing the ocaml compiler source code, it appears that unless you pass the
      -nopervasives argument to the compiler, the code will be linked with the
      advapi32.lib library when compiling to native Windows code.

      I should probably just try to get a copy of Visual C++ 2003, since according
      to the ocaml docs I should be using MSVC 6 or 7 (2003), and not 8 (2005).

      Thanks for your help.

      Tony
    • Show all 6 messages in this topic