Ocaml windows standalone exe issue

Hello, I’ve just installed the ocaml dev environment on a windows 11 system, using opam 2.2.
Trying the hello world example using Dune i found that on first run, the executable takes more than 20 secs to start. Successive run starts immediately.

I remember that utop did the same thing on first run. Any hints?

That sounds like Windows Defender or some other malware/anti-virus checker on your machine doing a scan. If it is, eventually it will get worse; you will start running into your executables randomly being deleted. Try adding a folder exclusion to your development directory (ex. C:\source) in Defender/Norton/whatever you have; Add an exclusion to Windows Security - Microsoft Support (edit) has instructions for Defender.

2 Likes

@jbeckford That page 404s for me.

1 Like

The link is fixed. Thanks!

Thank you, I’m running Avira AV, excuded the project folder and the problem seems to be solved.
Do you think I have to exclude some other folder or file?

You should add the opam root folder as well. Run:

opam var root

to show the folder.

1 Like

Done, just one more question,
Should I rerun “opam init” to use different shell (PowerShell, Win11 prompt, cygwin)?

PS: Have a nice Halloween night :slight_smile:

1 Like

The opam init is independent of the shell, except perhaps under Cygwin. (Someone from the opam team will need to answer that)

I typically use PowerShell inside Windows Terminal or inside Visual Studio Code for OCaml development. That makes it easy to copy and paste commands from Unix-oriented sites … without having to translate / into \, etc.

Ok, thanks again I’m going to install and configure VSCode in the evening, ITA time.