Skip to content

Missing stdout generated by ffi calls

Created by: tumdum

I have this small c file:

    #include <stdio.h>
     
    void f1(void) {
      printf("f1 called\n");
    }

Which can be compiled into shared library with this command:

gcc lib.c -fpic -shared -o libx.so

I use this library in small Racket program:

    #lang racket
     
    (require ffi/unsafe
             ffi/unsafe/define)
     
    (define-ffi-definer define-x (ffi-lib "/home/klak/Developer/racket-ffi/libx.so"))
     
    (define-x f1 (_fun -> _void))
     
    (void (f1))

When I runt that script via command line repl I can see output from f1:

$ racket
Welcome to Racket v6.12.
> ,enter "main.rkt"
f1 called
"main.rkt"> (f1)
f1 called
"main.rkt"> (void (f1))
f1 called
"main.rkt">

Running this under geiser does not show stdout.

Edited by jao