# Compiling for Windows XP

**URL:** <https://discuss.ocaml.org/t/compiling-for-windows-xp/5125>\
**Category:** Ecosystem\
**Created:** [February 5, 2020, 9:23am UTC](https://discuss.ocaml.org/t/compiling-for-windows-xp/5125 "2020-02-05T09:23:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttamttam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ttamttam/32/132_2.png) [@ttamttam](https://discuss.ocaml.org/u/ttamttam)\
**Post date:** [February 5, 2020, 9:23am UTC](https://discuss.ocaml.org/t/compiling-for-windows-xp/5125/1 "2020-02-05T09:23:39Z")

</div>

Hello,

I’m trying to resurrect and improve an old program of mine which I want to run on one Windows XP system. If I’m asking here, it means that I’m failing.

Here is a minimal Hello World program which also do nothing on my XP box. Any idea what I could check or try?

The program `hw.ml`:

```auto
let () = print_endline "Hello"

```

The associated `dune` file:

```auto
(executable (name hw))

```

On the development system, the opam switch is `ocaml-variants.4.10.0+beta1+mingw32`.

It runs successfully, being started from `cygwin` or from `cmd` on the Windows 7 development system.

It seems the generated file has the right format:

```bash
$ file hw.exe
hw.exe: PE32 executable (console) Intel 80386, for MS Windows

```

I do not understand why it is not working on the XP system?

Any hint?

---

<div class="post-metadata">

**Author:** ![ttamttam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ttamttam/32/132_2.png) [@ttamttam](https://discuss.ocaml.org/u/ttamttam)\
**Post date:** [February 5, 2020, 9:42am UTC](https://discuss.ocaml.org/t/compiling-for-windows-xp/5125/2 "2020-02-05T09:42:48Z")

</div>

Oh! It seems to work with 4.02.3+mingw32c switch…

Mmm. I’m going to check if my real program is compiling with this version. And I’ll have to bissect in order to find out the first version with which it stopped working in order to understand the reason…

---

<div class="post-metadata">

**Author:** ![fdopen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/fdopen/32/452_2.png) [@fdopen](https://discuss.ocaml.org/u/fdopen)\
**Post date:** [February 5, 2020, 10:18am UTC](https://discuss.ocaml.org/t/compiling-for-windows-xp/5125/3 "2020-02-05T10:18:30Z")

</div>

The program is dynamically linked against various dlls (advapi32.dll, msvcrt.dll,…) and depend on an ABI that is only supported by the dlls shipped with Windows Vista or later.  
These incompatibilities were introduced by recent changes in the C toolchain (i686-w64-mingw32-gcc and related tools) and the OCaml toolchain itself.

You have to use an older OCaml version and you might need to install an older version of i686-w64-mingw32-gcc (via [http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html](http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html) ).

---

<div class="post-metadata">

**Author:** ![ttamttam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ttamttam/32/132_2.png) [@ttamttam](https://discuss.ocaml.org/u/ttamttam)\
**Post date:** [February 5, 2020, 11:33am UTC](https://discuss.ocaml.org/t/compiling-for-windows-xp/5125/4 "2020-02-05T11:33:12Z")

</div>

Thanks for your explanation and links.

Don’t you think that the line 48 in [https://github.com/ocaml/ocaml/blob/trunk/README.win32.adoc](https://github.com/ocaml/ocaml/blob/trunk/README.win32.adoc) should be adapted, then?

Best regards
