Re: C Struct Support
- Posted by mattlewis (admin) Dec 29, 2010
- 1882 views
Will there be nesting (structures within structures)?
Yes. There are preprocessor/proof of concept examples that do this. I've also got some examples of using unions.
Will there be pointers within structures?
Yes.
Will there be access to dlls built with C compilers?
I'm not sure what you mean by this. This won't affect the direct interface between euphoria code and DLLs. It should make it easier to communicate with those DLLs that use memory structures. Basically, you'll use the same pointer you would now, except that instead of using peek() and poke(), you can use a more descriptive syntax. Also, you shouldn't have to manually calculate offsets.
Ideally, we'll be able to define and use any sort of structure that you'd encounter in C code. At this time, I'm not planning to support bitfields, since they're non-standard, and compilers appear to implement them differently.
The main benefit will be for people who write code that directly interfaces with external libraries or the back end of the interpreter. I recommend taking a look at the code I posted earlier. I have several examples, including the Euphoria Symbol Table as it exists in the interpreter, plus a few Win32 structures I grabbed from Win32Lib.
So anyone who writes code that does this sort of thing should chime in. If I don't get any feedback, you'll probably be stuck with whatever I come up with.
Matt