caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Interfacing C with OCaml and file descriptors
@ 2017-10-13 10:57 Laurent Thévenoux
  2017-10-13 11:10 ` Nicolás Ojeda Bär
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Laurent Thévenoux @ 2017-10-13 10:57 UTC (permalink / raw)
  To: caml-list

Hi,

I have a naive question about file descriptors and C interface (when interfacing C with OCaml).

For instance, a file.ml file which looks like:


external my_c_interface : out_channel -> int = c_function


where c_function writes something to a file and return the number of written char.
The c_function takes a FILE* file descriptor, as for example:


CAMLprim value c_function (value channel)
{
	CAMLparam1 (channel);
	FILE* fd = ???;
	CAMLreturn (Val_int (call_to_c_func (fd)));
}


So, if possible, how to convert the ‘value channel’ to a ‘FILE*’?

Thanks for your help,
Laurent

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-10-16  6:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 10:57 [Caml-list] Interfacing C with OCaml and file descriptors Laurent Thévenoux
2017-10-13 11:10 ` Nicolás Ojeda Bär
2017-10-13 21:37 ` Richard W.M. Jones
2017-10-13 22:42   ` David Allsopp
2017-10-14  6:10     ` Richard W.M. Jones
2017-10-14 15:18   ` Malcolm Matalka
2017-10-14 15:54 ` Thierry Martinez
2017-10-16  6:46   ` Laurent Thévenoux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).