Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
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