<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2009/01/f07ac7ee0e665fad4852aa168e28aa87"
  from="malc &lt;av1474@c...&gt;"
  author="malc"
  date="2009-01-13T09:37:35"
  subject="Re: [Caml-list] caml_alloc + 64 bits - caml_alloc.h"
  prev="2009/01/dfa16fa6cde45b0b9c18c01c9d244935"
  next="2009/01/02a1dc13761c00a5ecd8c78499f170b7"
  prev-in-thread="2009/01/dfa16fa6cde45b0b9c18c01c9d244935"
  next-in-thread="2009/01/ae41b4ef4303a34e5ea7b4f7d49b172a"
  prev-thread="2009/01/6d098a9e0587a2759e2b95fbcda926ab"
  next-thread="2009/01/02a1dc13761c00a5ecd8c78499f170b7"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="caml_alloc + 64 bits - caml_alloc.h">
<msg 
  url="2009/01/d872246fc16e795f138c798f5c03dea4"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2009-01-13T04:51:17"
  subject="caml_alloc + 64 bits - caml_alloc.h">
<msg 
  url="2009/01/0960a466366b13749e304c4acf6d5d49"
  from="Erik de Castro Lopo &lt;mle+ocaml@m...&gt;"
  author="Erik de Castro Lopo"
  date="2009-01-13T04:58:18"
  subject="Re: [Caml-list] caml_alloc + 64 bits - caml_alloc.h">
<msg 
  url="2009/01/dfa16fa6cde45b0b9c18c01c9d244935"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2009-01-13T05:15:33"
  subject="Re: [Caml-list] caml_alloc + 64 bits - caml_alloc.h">
</msg>
</msg>
<msg 
  url="2009/01/f07ac7ee0e665fad4852aa168e28aa87"
  from="malc &lt;av1474@c...&gt;"
  author="malc"
  date="2009-01-13T09:37:35"
  subject="Re: [Caml-list] caml_alloc + 64 bits - caml_alloc.h">
<msg 
  url="2009/01/ae41b4ef4303a34e5ea7b4f7d49b172a"
  from="Olivier Andrieu &lt;oandrieu@n...&gt;"
  author="Olivier Andrieu"
  date="2009-01-13T10:26:38"
  subject="Re: [Caml-list] caml_alloc + 64 bits - caml_alloc.h">
</msg>
</msg>
</msg>
</thread>

<contents>
On Tue, 13 Jan 2009, Daniel de Rauglaudre wrote:

&gt; Hi everybody,
&gt;
&gt; Possibly useful information. Is it already known?
&gt;
&gt; When using calls to "caml_alloc" in a 64 bits architecture without
&gt; having included "caml/alloc.h", it raises "Segmentation fault" at
&gt; execution time.
&gt;
&gt; Notice that I got no warning at compilation time for using caml_alloc
&gt; without a definition stub.
&gt;
&gt; In 32 bits architecture, I never had any problem with that.

caml_alloc returns value which is typedefed to intnat which in turn
is long which is 64bit on LP64 architectures (for all practical
intents and purposes anything that is not Win64), when prototype
for caml_alloc is missing it is assumed to be `int caml_alloc();'
assigning the return value of this call to value will sign extend
it with devastating results (upper 32bit lost forever)

&gt; Morality:
&gt;   Don't forget to #include "caml/alloc.h" in your C programs
&gt;   if you alloc OCaml things!

Moraility is to follow relevant standard actually..

P.S. This whole value-&gt;intnat-&gt;long makes me wonder how OCaml is
      ever supposed to work on LLP64...

-- 
mailto:av1474@comtv.ru

</contents>

</message>

