/tutorial/cecil/etl/c_prog.c

http://github.com/tybor/Liberty · C · 23 lines · 16 code · 7 blank · 0 comment · 0 complexity · 6da68b9335ffdf0a4126dd1257c7121a MD5 · raw file

  1. #include "eiffel.h"
  2. static EIF_OBJ c_side_memory;
  3. void send_factory_to_c(EIF_OBJ example) {
  4. c_side_memory = EXAMPLE_new_string(example, "foo\n");
  5. }
  6. EIF_OBJ string_back_to_eiffel(void) {
  7. return c_side_memory;
  8. }
  9. #define eif_adopt(x) (EIF_STUFF_eif_adopt(0,(x)))
  10. void call_eif_adopt_from_c(void) {
  11. eif_adopt(c_side_memory);
  12. }
  13. #define eif_wean(x) (EIF_STUFF_eif_wean(0,(x)))
  14. void call_eif_wean_from_c(void) {
  15. eif_wean(c_side_memory);
  16. }