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] Camlidl and order of include files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-31 (10:22)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] Camlidl and order of include files
John Gerard Malecki <johnm@artisan.com> writes:

> I just tried camlidl and am not sure if I am using it wrong or if I
> have encountered a bug.  I want to access the (solaris) sysconf system
> routine to find out how many processors on a machine.  I wrote this
> idl file
>   quote(C,"#include <unistd.h>")
>   enum sysconf_names {
>   };

Use quote(h,"#include <unistd.h>")

and then C stubs will compile, but your code still will be incorrect. How
the generated Caml part will know the value of _SC_NPROCESSORS_ONLN?
Obviously, it is not defined for Camlidl. It should generate an error
message here. It does not, and that's the bug in Camlidl (you can submit a
bug report). As for correct solution, you should either convert <unistd.h>
to IDL and then use

#include unistd.idl
enum sysconf_names {

or resolve _SC_NPROCESSORS_ONLN macro manually:

quote(C,"#include <unistd.h>")

enum sysconf_names {

Hope to hear from you soon,

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr