Hi,

On Fri, 7 Dec 2012 14:43:23 -0500
Ashish Agarwal <agarwal1...@gmail.com>
wrote:
> I managed to compile an executable. Will it run standalone on another
> Windows machine?

It depends on the libraries that you use.

ocaml libraries:
  Some libraries use hardcoded paths, most notably batteries (is uses
  camomile in the wrong way) and ocamlnet. 
  Running your program on another machine requires additional
  workarounds.  
  Solution for batteries: You need to set the environment
  variable CAMOMILE_DIR on each machine. 
   You can also do this inside your program, eg:
    let dir = .... (* could be relative to the current program *)
    let () = Unix.putenv "CAMOMILE_DIR" dir
   However, you have to make sure that this code and camomile are
   linked in the right order (often a non-trivial task. Your buildtool
   might enforce a linking order) 
  In case of ocamlnet, you must manually load the files
  under /opt/godi32/share/godi-ocamlnet in your program (possible at
  compile time with Marshal)

c/c++-libaries (base-*):
  You need to ship all necessary dlls ( use
  http://www.dependencywalker.com/  or a similar tool ) 
  It's even more difficult for complex libraries like gtk2 that require
  additional files.
  Some libraries also depend on c++ runtime libraries from microsoft
  ("Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)", etc).
  They are usually installed by the windows update service, but not
  always.

> How come in a cmd.exe window, I can see the file using ls but not dir?
> 
> C:\Program Files\Foo> ls
> foo
> 
> C:\Program Files\Foo> dir
> Volume in drive C has no label.
> ...
> 0 File(s)     0 bytes

You should explicitly add exe-suffixes in your makefiles. 

During package creation, I remove all cygwin-related file attributes
and replace cygwin symlinks with copies.
The build infrastructure (shell, gcc,...) relies on cygwin,
but the ocaml compiler and the compiled programs don't understand cygwin
conventions. Sometimes, this leads to unexpected behaviour. 

cu,
 Andreas 

_______________________________________________
Godi-list mailing list
Godi-list@ocaml-programming.de
https://godirepo.camlcity.org/mailman/listinfo/godi-list

Reply via email to