Welcome to the CHICKEN Scheme pasting service

ffi string added by alicemaz on Thu Sep 3 20:22:56 2020

alice@bellona:/tmp/ffitest % cat src/ffitest.scm
(module ffitest ()

(import scheme)
(import chicken.base)
(import chicken.type)
(import chicken.string)
(import chicken.format)
(import chicken.foreign)
(import chicken.memory)

(define passback (foreign-lambda* c-string ((c-string s)) #<<EOF
s[0] = 'b';
C_return(s);
EOF
))

(define (main)
  (define s "alice")
  (printf "s:  ~S ~S\n" s (object->pointer s))
  (define s^ (passback s))
  (printf "s^: ~S ~S\n" s^ (object->pointer s^))
  (exit 0))

(main)

)
alice@bellona:/tmp/ffitest % pontiff build && pontiff run
checking dependencies
building ffitest
* preparing modules... done
* checking module graph... done
* determining build order... done
compiling 1/1 modules (dynamic)
* csc done
* cc done
* ld done
compilation finished
ffitest build finished
all builds complete
running ffitest...
s:  "alice" #<pointer 0x5590fd60c780>
s^: "blice" #<pointer 0x7ffdbf88b970>

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `process-wait'?
Visually impaired? Let me spell it for you (wav file) download WAV