Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: Olivier Andrieu <andrieu@oxygene.ijm.jussieu.fr>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: libplot for OCaml?
Date: Mon, 4 Dec 2000 12:32:04 +0100	[thread overview]
Message-ID: <20001204123204.A12283@miss.wu-wien.ac.at> (raw)
In-Reply-To: <14891.28540.612485.383571@akasha.ijm.jussieu.fr>; from andrieu@oxygene.ijm.jussieu.fr on Mon, Dec 04, 2000 at 11:18:36 +0100

On Mon, 04 Dec 2000, Olivier Andrieu wrote:
> Markus Mottl writes:
>  > has anybody already considered implementing an interface to the
>  > libplot-library?
>  > [ ...]	
>  > I don't have time to do it right now, but if anybody wants to give
>  > it a try, I could imagine helping a bit. It doesn't look terribly
>  > difficult and may be a good exercise to try out camlidl...

> I had never heard of both libplot and camlidl, so your post was a
> revelation for me ! So, I tried to generate stub code for the libplot
> header with camlidl. Seems to work fine, but I have a little problem :
> some functions in libplot take FILE* arguments. Since that's not a
> `basic' type, it is not handled by camlidl. Nevertheless, I guess it
> could be possible to map an in_channel (or out_channel) CAML type to
> a FILE struct. 

Unfortunately, there does not seem to be a basic type for this in camlidl
- yet. Maybe the developers can tell us which would be the best way to
do it with camlidl?

Otherwise, it is always possible to use "c2ml" and"ml2c" for conversions.

I haven't tried it, but the following might work:

Use the conversion macros and functions defined in "byterun/io.{h,c}":

The "Channel"-macro gives you access to the C-representation of
OCaml-channels. Then you can get at the Unix file descriptor with:

  int fd = Channel(some_channel)->fd;

Now you can use "fdopen" (see man page for details):

  FILE *file = fdopen(fd, some_mode);

It doesn't look terribly difficult, but some support for this in camlidl
would be very nice! Or maybe there are already other (better) ways to do it?

Best regards,
Markus Mottl

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl



      parent reply	other threads:[~2000-12-04 22:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-25 10:42 Markus Mottl
2000-11-27  8:56 ` Sven LUTHER
2000-11-27 10:57   ` Markus Mottl
2000-11-27 11:42     ` Sven LUTHER
     [not found] ` <14891.28540.612485.383571@akasha.ijm.jussieu.fr>
2000-12-04 11:32   ` Markus Mottl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001204123204.A12283@miss.wu-wien.ac.at \
    --to=mottl@miss.wu-wien.ac.at \
    --cc=andrieu@oxygene.ijm.jussieu.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox