Have a look into the sources of pure-sockets, pure-sql3, etc. @
https://github.com/agraef/pure-lang. There you'll certainly see how it works.
AFAIK structs are handled by pointers (void*) only, that is you sometimes have
to write some additional helper functions in C yourself (mostly for convenience).
For example, when you look at the structure at the top of the attached defs.h,
and a C function e.g.
int ispoly(U *p, U *x);
it reads in Pure simply as
extern int ispoly(void *p, void *x);
That is, you don't have to care about "U" itself as long as you are not
interested in particular slots. However, if you want access to the internals of
U, then it will be useful to write some "accessors" in C which can be imported
using simple return types.
Sometimes it will be necessary to "malloc", but this works fine, usually:
let env = NULL ;
assert fact::string = EnvAssertString env fact ;
showpp fact::pointer = string buf
when buf = malloc 256; EnvGetFactPPForm env buf 256 fact end ;
Hope this helps a bit.
Kurt
> --
> You received this message because you are subscribed to the Google Groups
> "pure-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to
pure-lang+...@googlegroups.com
> <mailto:
pure-lang+...@googlegroups.com>.
> To post to this group, send email to
pure...@googlegroups.com
> <mailto:
pure...@googlegroups.com>.
> Visit this group at
https://groups.google.com/group/pure-lang.
> For more options, visit
https://groups.google.com/d/optout.