
On Wed, 2007-03-14 at 09:56 +1100, Donald Bruce Stewart wrote:
magnus:
I'm trying to use c2hs but get stuck when including sys/types.h (though the problem really resides in pthreadtypes.h):
% ./Setup.hs build -v Preprocessing executables for kowasu-0.1... /usr/bin/c2hs -C -D__GLASGOW_HASKELL__=606 -C -Icsrc -o src/Kowasu/PTrace.hs src/Kowasu/PTrace.chs c2hs: Error in C header file.
/usr/include/bits/pthreadtypes.h:69: (column 6) [FATAL]
Syntax error! The symbol `;' does not fit here.
The part of pthreadtypes.h where it chokes seems to be
65 __extension__ union 66 { 67 int __spins; 68 __pthread_slist_t __list; 69 }; 70 } __data; 71 char __size[__SIZEOF_PTHREAD_MUTEX_T]; 72 long int __align; 73 } pthread_mutex_t;
Any pointers on how to solve this? (Besides manually resolving all defined types down to the C builtins.)
/M
Does it help to use the darcs version of c2hs? I've heard rumours that it can parse the linux kernel now..
Yes, I do have a C parser that can parse the linux kernel and that of course includes anonymous structs and unions. Currently I'm part way through merging these changes into the darcs version of c2hs. So, Magnus, you can wait 'til I finish merging my changes into c2hs or you can have a go yourself if you're desperate. I posted the full code recently: http://haskell.org/~duncan/c2hs/c2hs-newparser.tar.gz That's just a snapshot of my development tree, so don't expect it to work 'out of the box'. In particular the rest of c2hs doesn't understand the new extensions that the parser can now handle. Duncan