> I can't imagine just chopping "struct" off a type declaration (moving
> it from one namespace to another!) can be the solution.  Can we start
> with an example?
> 
> I tried generating a shim for the API you gave and had no problem.
> 
>     (typedef a (struct (x int)))
> 
>     (extern (* a) test_func (arg (* a)))

You are of course entirely correct, I omitted the typedef (and used a
named struct), which resulted (correctly) in incorrect C code. The above
code works fine!

> There IS a problem with
> 
>     (extern a test_func (arg a))
> 
> signaled by a warning "Unexpected return type: (struct (x . int))".
> (It could call that an "unsupported return type", and warn about the
> type of ARG too.)

I've been playing around with the shim C code, is there a way I can
create an alien that contains a struct? Then it should be possible to
support structs as return and parameter types. Are aliens
garbage-collected automatically? Can I just malloc some memory for an
alien, then cons_alien it, then expect it to be garbage-collected later?

Thanks for helping me with my questions here!

Peter


_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to