English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Binding C libraries which use variable arguments (stdarg.h)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-10-30 (09:35)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)
[Invoking a variadic C argument from OCaml]

>> Assuming a Linux system, you could lazily generate the glue code and
>> invoke dynamic linker on it. So the general case would be to call the
>> code generator.
> On linux and x86, I could probably use an array where I would move by
> sizeof(some_type). I really want portability however (I want to use
> 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