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] How to avoid duplicate type declarations in C files with camlidl?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-18 (04:23)
From: nick.name@i...
Subject: [Caml-list] How to avoid duplicate type declarations in C files with camlidl?
Hi all, I am stuck with camlidl: I want to declare a struct wich does not go 
in the produced .h file, because I (obviously) want to use the system header 
files. I don't seem to understand how to do so: here's my attempt

quote(h,"#include <sys/types.h>");
quote(h,"#include <dirent.h>");
quote(h,"#include <unistd.h>");

typedef [abstract] void DIR;

struct dirent 
  long int d_ino;
  [string] char d_name[256];

[unique] DIR * opendir([in,string] char *name);
[unique] struct dirent * readdir([in,ref] DIR *dir);

Written this way, the generated C and the header are wrong, because they 
contain a declaration for "DIR" , wich already exists, however I realize that 
dir is done with a macro. But the generated C source also contains a 
declaration for dirent, and according to the same example in the manual, it 
should not! Can someone show me how to compile and run this simple example? I 
have also tried the tests distributed with camlidl but I get so much 
compilation errors and in such different ways :) that I gave up.

Thanks in advance


To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners