[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FFI Idea
From: |
Scheming Pony |
Subject: |
FFI Idea |
Date: |
Wed, 19 Feb 2020 04:20:53 +0000 |
In S7 Scheme, you can define C code by embedding it in Scheme:
(c-define '((in-C "static char *read_dir(DIR *p) \
{ \
struct dirent *dirp; \
dirp = readdir(p); \
if (!dirp) return(NULL); \
return(dirp->d_name); \
}")
(char* read_dir (DIR*)))
this defines Scheme callable function.
There are similar capabilities on other Scheme (Chicken) and Lisp (ECL)
implementations which generate C code.
I seem to remember MIT/Scheme being able to generate portable C code. Would
restricting use of MIT/Scheme to this mode facilitate techniques like the above
for FFI in MIT/Scheme? I know very little about Scheme/Lisp FFI internals, but
I thought someone here might know. I want to wrap a fairly large C++ library
using code generation, and having this would help.
- FFI Idea,
Scheming Pony <=