[Caml-list] ocamlc linking with .dll

2009-03-20 Thread Matthieu Dubuget
According to the manual,

for ocamlc:
> Arguments ending in .so (.dll under Windows) are assumed to be C
> shared libraries (DLLs).
> During linking, they are searched for external C functions referenced
> from the Caml code,
> and their names are written in the generated bytecode executable. The
> run-time system
> ocamlrun then loads them dynamically at program start-up time.

If I try:

> $ ocamlc -custom -o m.exe ms_gates.native.dll m_stub.c m.ml
> ** Cannot resolve symbols for m_stub.o:
>  _ms_gates_init
>  _ms_gates_version
> File "m.ml", line 1, characters 0-1:
> Error: Error while building custom runtime system


The dll is not passed to flexlink, as we can check with "-verbose":

> $ ocamlc -custom -o m.exe -verbose ms_gates.native.dll
> m_stub.c m.ml
> + gcc -mno-cygwin -O -mms-bitfields -Wall -Wno-unused -c  
> -I"C:/cygwin/home/matt/ocamlmgw/lib" "m_stub.c"
> + flexlink -chain mingw -exe -o "m.exe"  
> "-LC:/cygwin/home/matt/ocamlmgw/lib"
> "c:\DOCUME~1\matt\LOCALS~1\Temp\camlprimec3406.c" "m_stub.o"
> "-lcamlrun" -lws2_32
> ** Cannot resolve symbols for m_stub.o:
>  _ms_gates_init
>  _ms_gates_version
> File "m.ml", line 1, characters 0-1:
> Error: Error while building custom runtime system


This is solved by adding -cclib in front of the dll name:


> $ ocamlc -custom -o m.exe -verbose -cclib ms_gates.native.dll
> m_stub.c m.ml
> + gcc -mno-cygwin -O -mms-bitfields -Wall -Wno-unused -c  
> -I"C:/cygwin/home/matt/ocamlmgw/lib" "m_stub.c"
>
> + flexlink -chain mingw -exe -o "m.exe"  
> "-LC:/cygwin/home/matt/ocamlmgw/lib"
> "c:\DOCUME~1\matt\LOCALS~1\Temp\camlprimc0b326.c"
> "ms_gates.native.dll" "m_stub.o" "-lcamlrun" -lws2_32
>

Is there a bug, either in the documentation or in ocamlc?

Salutations

Matt

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: ocamlc linking with .dll

2009-03-20 Thread Matthieu Dubuget
With ocamlopt, if a dll is given as is the message is:


>  C:\cygwin\home\matt\ocamlmgw\bin\ocamlopt.exe: don't know what to do
with 16x64_pocket.dll.

Salutations

Matt
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Compiling ocaml-ssl under windows (mingw)

2009-03-20 Thread Alan Schmitt

On 10 mars 09, at 20:53, Stéphane Glondu wrote:


Alan Schmitt a écrit :

[...] For instance, could I use lwt under Windows?


FYI, Unison uses lwt and works under Windows.


Hello,

I am trying to use lwt under windows (using mingw), and I cannot get  
it to compile, because I cannot compile the required ocaml-ssl. One  
first problem I had was finding a mingw compatible version of openssl  
(as lwt seems to require ocaml-ssl), but I finally found it. Now  
compiling ocaml-ssl fails with the following:


ocamlmklib  -o ssl_stubs  ssl_stubs.o -lcrypto -lssl
make[11]: ocamlmklib: Command not found

I checked, and my godi installation of ocaml does not provide  
ocamlmklib.


Is there a way around this?

Thanks a lot,

Alan

PGP.sig
Description: This is a digitally signed message part
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Compiling ocaml-ssl under windows (mingw)

2009-03-20 Thread Jerome Vouillon
Hi Alan,

On Fri, Mar 20, 2009 at 03:38:22PM +0100, Alan Schmitt wrote:
> I am trying to use lwt under windows (using mingw), and I cannot get it 
> to compile, because I cannot compile the required ocaml-ssl.

I believe you can compile Lwt without the ocaml-ssl library by just
removing file src/lwt_ssl.mllib

In file src/lwt_unix.ml, you should also change the line:
  let windows_hack = Sys.os_type <> "Unix"
into
  let windows_hack = false
This was a hack to make Unison work properly under Windows even though
"select" did not support pipes.  As the implementation of "select" has
been improved in Ocaml 3.11, it should no longer be necessary.

-- Jerome

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Compiling ocaml-ssl under windows (mingw)

2009-03-20 Thread Alan Schmitt

On 20 mars 09, at 16:25, Jerome Vouillon wrote:


Hi Alan,

On Fri, Mar 20, 2009 at 03:38:22PM +0100, Alan Schmitt wrote:
I am trying to use lwt under windows (using mingw), and I cannot  
get it

to compile, because I cannot compile the required ocaml-ssl.


I believe you can compile Lwt without the ocaml-ssl library by just
removing file src/lwt_ssl.mllib


OK. I wanted to install it through godi, but I guess it will be  
simpler to compile it directly. (The ideal would be a configuration  
option to have ssl as optional.)



In file src/lwt_unix.ml, you should also change the line:
 let windows_hack = Sys.os_type <> "Unix"
into
 let windows_hack = false
This was a hack to make Unison work properly under Windows even though
"select" did not support pipes.  As the implementation of "select" has
been improved in Ocaml 3.11, it should no longer be necessary.


Very interesting, I was not aware of this.

Thanks,

Alan


PGP.sig
Description: This is a digitally signed message part
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Camlp4 help

2009-03-20 Thread Andre Nathan
Hello

I'm just beginning with camlp4 here, and I'm stuck with what I think is
a precedence issue. I have the following syntax extension:

open Camlp4.PreCast
open Syntax

let sum = Gram.Entry.mk "sum"

EXTEND Gram
  expr: LEVEL "top"
[ [ "sum"; "do"; seq = LIST1 sum; "done" ->
<:expr< do { $list:seq$ } >> ] ]
;
  sum:
[ [ x = expr; "plus"; y = expr ->
<:expr< $x$ + $y$ >> ] ]
;
END

This works fine for something like this:

sum do
  1 plus 2
done

which becomes (1 + 2).

However, it breaks on

sum do
  let a = 1 in
  let b = 2 in
  a plus b
done

because it becomes ((let a = 1 in let b = 2 in a) + b).

How can fix that (allowing "b" to be in scope for the second argument of
"plus")?

Also, sequences of operations don't parse:

sum do
  1 + 2;
  3 + 4
done

gives "Parse error: [sum] or "done" expected (in [expr])"

What am I missing here?

Thanks in advance,
Andre

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs