Skip to content

Instantly share code, notes, and snippets.

@shakdwipeea
Created August 27, 2019 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakdwipeea/92930430aac396db43506a3ef77466eb to your computer and use it in GitHub Desktop.
Save shakdwipeea/92930430aac396db43506a3ef77466eb to your computer and use it in GitHub Desktop.
(import :std/foreign)
(export #t)
(begin-ffi (first-c
malloc-integer-list)
(define-c-lambda first-c
((pointer (pointer int)))
(pointer int)
"___return (*___arg1);")
(define-c-lambda malloc-integer-list
() (pointer (pointer int))
"int **a = (malloc(sizeof(int) * 4));
*a = 12;
___return (a);"))
(define a (lambda () (first-c (malloc-integer-list))))
(define (main )
(display (a)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment