<?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/10/695b35c7584e6179c596cc18c578c36c"
  from="Xavier Leroy &lt;Xavier.Leroy@i...&gt;"
  author="Xavier Leroy"
  date="2009-10-30T09:35:03"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)"
  prev="2009/10/1fa25b75a89559ed7c63df5845298c27"
  next="2009/10/5efd3ac5be44f2f55ec5ca61f3280bb5"
  prev-in-thread="2009/10/88641fef6c963d890d6c941607d4dd4c"
  next-in-thread="2009/11/c25b776f5816dc40e98663c70d4d8196"
  prev-thread="2009/10/bbb95d9e0194e1762c52367d01c48687"
  next-thread="2009/11/e2224339ec0b2824c1fc28558cc04bee"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/10/63300d21e98ae03b875913a3e95f0dea"
  from="Adrien &lt;camaradetux@g...&gt;"
  author="Adrien"
  date="2009-10-28T22:07:50"
  subject="[Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/10/17b019522632b07b514e5be4e75fa7b5"
  from="Basile STARYNKEVITCH &lt;basile@s...&gt;"
  author="Basile STARYNKEVITCH"
  date="2009-10-28T22:45:27"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)">
<msg 
  url="2009/10/1dba359e027f2371c3353f1093257973"
  from="Goswin von Brederlow &lt;goswin-v-b@w...&gt;"
  author="Goswin von Brederlow"
  date="2009-10-29T08:55:45"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)">
<msg 
  url="2009/10/c3d6a2b5703ff6f6470263a84a2e2610"
  from="Adrien &lt;camaradetux@g...&gt;"
  author="Adrien"
  date="2009-10-29T21:37:16"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/10/220b341f580c2f05dcd1fe43af8195cf"
  from="Goswin von Brederlow &lt;goswin-v-b@w...&gt;"
  author="Goswin von Brederlow"
  date="2009-10-29T23:31:43"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
</msg>
</msg>
</msg>
<msg 
  url="2009/10/88641fef6c963d890d6c941607d4dd4c"
  from="Adrien &lt;camaradetux@g...&gt;"
  author="Adrien"
  date="2009-10-29T21:18:32"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/10/695b35c7584e6179c596cc18c578c36c"
  from="Xavier Leroy &lt;Xavier.Leroy@i...&gt;"
  author="Xavier Leroy"
  date="2009-10-30T09:35:03"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)">
<msg 
  url="2009/11/c25b776f5816dc40e98663c70d4d8196"
  from="Adrien &lt;camaradetux@g...&gt;"
  author="Adrien"
  date="2009-11-01T09:31:22"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/11/c9f5cdae61a375516b1c7f58f7c8a24c"
  from="Florian Weimer &lt;fw@d...&gt;"
  author="Florian Weimer"
  date="2009-11-01T11:07:48"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/11/30d1a6db7b740e167f15d4d3fc8aff0a"
  from="Adrien &lt;camaradetux@g...&gt;"
  author="Adrien"
  date="2009-11-01T12:12:36"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/11/9b89b9c7f37c9669467ce973d1ce2cd9"
  from="Florian Weimer &lt;fw@d...&gt;"
  author="Florian Weimer"
  date="2009-11-01T12:16:30"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/11/6c1b3d299b19d3da9f11ba1908e5969f"
  from="Adrien &lt;camaradetux@g...&gt;"
  author="Adrien"
  date="2009-11-01T14:58:48"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
<msg 
  url="2009/11/8bc8d525d56eeb42e638223e6eac0c92"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2009-11-01T20:06:49"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)">
</msg>
<msg 
  url="2009/11/5272114d3fb3e7ccacc5340cfb864f2e"
  from="Florian Weimer &lt;fw@d...&gt;"
  author="Florian Weimer"
  date="2009-11-03T19:33:20"
  subject="Re: [Caml-list] Binding C libraries which use variable arguments  (stdarg.h)">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
[Invoking a variadic C argument from OCaml]

&gt;&gt; Assuming a Linux system, you could lazily generate the glue code and
&gt;&gt; invoke dynamic linker on it. So the general case would be to call the
&gt;&gt; code generator.
&gt; 
&gt; On linux and x86, I could probably use an array where I would move by
&gt; sizeof(some_type). I really want portability however (I want to use
&gt; these bindings at least on windows too).

It might be worth investigating the "libffi" library.  If I guess
correctly, it lets you synthesize calls to native C functions when the
number and type of arguments are statically unknown.

- Xavier Leroy

</contents>

</message>

