Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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)
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 Archives:
Bug reports: FAQ:
Beginner's list: