<?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="2006/02/7bdea4caa181776d4c2dc27c6d233e19"
  from="Till Varoquaux &lt;till.varoquaux@g...&gt;"
  author="Till Varoquaux"
  date="2006-02-08T22:22:53"
  subject="Limitations of continuation?"
  prev="2006/02/69ecf29a7a4b470c82efbd9670ae271b"
  next="2006/02/e32a56a54549a51d40bf49d519307fa3"
  prev-thread="2006/02/824d8233647c2ff564bcd55a138f5a35"
  next-thread="2006/02/8d1ebd59ac61d7633ba4489bb9092289"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Limitations of continuation?">
<msg 
  url="2006/02/7bdea4caa181776d4c2dc27c6d233e19"
  from="Till Varoquaux &lt;till.varoquaux@g...&gt;"
  author="Till Varoquaux"
  date="2006-02-08T22:22:53"
  subject="Limitations of continuation?">
</msg>
</thread>

<contents>
Xavier Leroy wrote a small continuation proof of concept module which
can be found here:
http://pauillac.inria.fr/~xleroy/software.html

I've been toying with it lately whilst doing so I stumbled across a problem:

I'm using a module containing the following code:

let continuation_to_string k =
  let c=Marshal.to_string k [Marshal.Closures] in
  Netencoding.Base64.encode ~linelength:72 c

let send_page (f:string-&gt;unit) =
  let apply f k=
    f (continuation_to_string k)
  in
  Callcc.callcc(apply f)

let _ =
  try (
    let cgi = new Netcgi.std_activation () in
    let res = (
      let cont=(cgi#argument "continuation") # value in
      Netencoding.Base64.decode ~accept_spaces:true cont
    ) in
    let k=Marshal.from_string res 0 in
    Callcc.throw k ())
  with Not_found -&gt; ()

I have a test app using this module. If I compile it with a standard
Open ... the code segfaults, however if I inline the code (i.e. not
actually putting it in a separate file) the application works just
fine. I guess the compiler builds different code since it is working
with modules. Where those this come from and would there be anyways to
work around it ?

Regards,
Till

</contents>

</message>

