From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA30427; Wed, 31 Oct 2001 00:08:05 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA30775 for ; Wed, 31 Oct 2001 00:08:04 +0100 (MET) Received: from bastion.artisan.com ([209.144.161.130]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f9UN83b16897 for ; Wed, 31 Oct 2001 00:08:03 +0100 (MET) Received: from ypmaster.artisan.com (ypmaster [172.16.2.1]) by bastion.artisan.com (8.9.2/8.9.2) with ESMTP id PAA15090 for ; Tue, 30 Oct 2001 15:08:47 -0800 (PST) Received: from brainiac.artisan.com (brainiac [172.16.10.88]) by ypmaster.artisan.com (8.9.2/8.9.2) with ESMTP id PAA11483; Tue, 30 Oct 2001 15:08:01 -0800 (PST) Received: (from johnm@localhost) by brainiac.artisan.com (8.9.2/8.9.2) id PAA29399; Tue, 30 Oct 2001 15:08:01 -0800 (PST) X-Authentication-Warning: brainiac.artisan.com: johnm set sender to johnm@artisan.com using -f From: John Gerard Malecki MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15327.13008.977353.705352@brainiac.artisan.com> Date: Tue, 30 Oct 2001 15:08:00 -0800 To: caml-list@inria.fr Subject: [Caml-list] Camlidl and order of include files X-Mailer: VM 6.92 under Emacs 20.4.1 X-Organization: Artisan Components, Inc. Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, 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 ") enum sysconf_names { SC_NPROCESSOR_ONLN = _SC_NPROCESSORS_ONLN }; long sysconf([in] enum sysconf_names name); I put this file in the camlidl-1.02/tests directory and executed 'make sysconf.o' only to get ../compiler/camlidl -header sysconf.idl ocamlc -I ../lib -c sysconf.mli ocamlc -I ../lib -c sysconf.ml gcc -Wall -I.. -I/home/vtools/sun4os5/apps/ocaml-3.02/lib/ocaml -c sysconf.c In file included from sysconf.c:16: sysconf.h:17: `_SC_NPROCESSORS_ONLN' undeclared here (not in a function) sysconf.h:17: enumerator value for `SC_NPROCESSOR_ONLN' not integer constant When I look in sysconf.c I notice #include "sysconf.h" #include If I change this order to #include #include "sysconf.h" The program now compiles and I am able to successfully use the code. :; cat test_sysconf.ml let _ = Printf.printf "sysconf ==> %d\n" (Sysconf.sysconf Sysconf.SC_NPROCESSOR_ONLN) :; ocamlc -c test_sysconf.ml :; ocamlc -custom sysconf.cmo test_sysconf.cmo sysconf.o :; ./a.out sysconf ==> 2 Am I making proper use of camlidl? ------------------- 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