/trunk/Examples/ocaml/string_from_ptr/foolib.i

# · Swig · 16 lines · 14 code · 2 blank · 0 comment · 0 complexity · dc415486546b099c7ed2f66836fdce74 MD5 · raw file

  1. %module foolib
  2. %{
  3. static int foo( char **buf ) {
  4. *buf = "string from c";
  5. return 0;
  6. }
  7. %}
  8. %typemap(in,numinputs=0) char **buf (char *temp) {
  9. $1 = &temp;
  10. }
  11. %typemap(argout) char **buf {
  12. swig_result = caml_list_append(swig_result,caml_val_string((char *)*$1));
  13. }
  14. int foo( char **buf );