<?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="2003/10/e8b532a1e5370741fb38319486356a7f"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-10-15T16:57:25"
  subject="[Caml-list] Initialization order bug"
  prev="2003/10/edeefa11537d0dda03680616cfa6a82f"
  next="2003/10/270e39fd60ffa2c8337369bc60b01baf"
  prev-in-thread="2003/10/c1af550ea8aa0a1e792263146a015857"
  next-in-thread="2003/10/c31697388e2560e2b0cff458c809794a"
  prev-thread="2003/10/3df891effe980ef58591b1b70f0a4bc3"
  next-thread="2003/10/3514d436ed9f160807888aa6f0870822"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] &quot;Error while building custom runtime system&quot;">
<msg 
  url="2003/10/c1af550ea8aa0a1e792263146a015857"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-10-15T09:36:16"
  subject="[Caml-list] &quot;Error while building custom runtime system&quot;">
<msg 
  url="2003/10/e8b532a1e5370741fb38319486356a7f"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-10-15T16:57:25"
  subject="[Caml-list] Initialization order bug">
<msg 
  url="2003/10/c31697388e2560e2b0cff458c809794a"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-10-16T09:18:40"
  subject="Re: [Caml-list] Initialization order bug">
</msg>
</msg>
</msg>
</thread>

<contents>
Related to the above issue is another strange bug in initialization order.

I have two libraries called:

	Perl
	  ^
	  |-------\
	  |	  | uses
	  |	Pl_LWP_UserAgent
	  |
	  | uses
	  |
	Test

But in this scenario, Perl is not initialized before Test starts
running (and hence the program crashes).

If I add a false dependency so that Test uses Pl_LWP_UserAgent, then
everything works (Perl is initialized OK before use).

Unfortunately this bug defies creating a minimal example, but if you
download:

http://www.annexia.org/tmp/perl4caml-0.3.2.tar.gz

then look at the top of examples/test.ml. Try running with and
without the fake 'let f = Pl_LWP_UserAgent.may' command at the
top of the file.

Without &amp; it segfaults because Perl is never initialized before
being called.

With &amp; it works OK.

The two other example programs already require one or other of the
Pl_* modules, so they work OK.

This is OCaml 3.07 from Debian/unstable.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you.
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl &amp; Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring:
http://www.annexia.org/freeware/monolith/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

