Re: development ideas for 4.1
- Posted by coconut Feb 11, 2011
- 1905 views
There is talk about making C structs easier and less error prone in EUPHORIA. The reason we need to interface with C is it is that most of the APIs are written in C. In addition of wrapping C structs you also have to declare your routines separately and you also must define the constant values.
Rather than doing all of this wouldn't be better if we could simply include the C header from the EUPHORIA file? We would need a way to tokenize preprocessor syntax and also C header syntax. I am taking this idea to the forum as it might attract ideas.
In theory, and for some really simple headers, this would probably work pretty well. But many headers will rely on other included headers for things like data types. Also, ifdefs and other preprocessor macros make this a lot more complicated. So, I'm sure that it's possible to do this for really simple headers, it wouldn't be a general solution, unless euphoria were also able to parse C.
The same is true for others complex toolkit as GTK+...
I'd be happy to be proven wrong, of course.
Matt
I agree with Matt, as in the past I tried to write a program that would convert C header to something usable directly by euphoria. I abandoned the project as I realized it would be more works that I thought at first. Just take windows SDK. In C to write a windows application one include windows.h but windows.h is only a top level include that itself includes others headers. And the include dept is deep, and as Matt says there is a lot of macros and ifdef...
Jacques.