steveh2009
2019-10-17 14:11:44

Don’t know if this has been worked on but it would be super useful to have a a #lang which could fully parse C prototypes, typedefs, structs, unions, etc and translate them to FFI calls. Then, hooking up C functions would be as easy as it’s done in luajit. [It’s beyond my abilities at this time in Racket experience]


soegaard2
2019-10-17 14:14:34

steveh2009
2019-10-17 14:17:02

Yes, I’ve started reading this today which had me thinking about luajit’s way of expressing its CFFI


steveh2009
2019-10-17 14:19:07

Your tutorial is excellent. But how good would it be to have a virtually zero barrier to FFI entry?


samth
2019-10-17 14:20:06

@xizhao there’s already a library that does some of this; https://docs.racket-lang.org/c-utils/index.html


soegaard2
2019-10-17 14:22:06

I am a little skeptical. The LuaJit page says: Given that the FFI library is designed to interface with C code and that declarations can be written in plain C syntax, it closely follows the C language semantics, wherever possible.


soegaard2
2019-10-17 14:23:12

This means that using the FFI will feel like writing a C program.


soegaard2
2019-10-17 14:25:28

The Racket FFI attempts to automate (or at least make it easier) to write bindings, whose users don’t need to know the underlying C library.



steveh2009
2019-10-17 14:36:12

@samth Do you think that library could be used as-is for the basis of an FFI code generator?


samth
2019-10-17 14:38:29

probably


steveh2009
2019-10-17 15:05:00

There’s a site called http://luapower.com\|luapower.com. It’s a repository for C libs callable from luajit. How much effort would it take to get them all working with Racket? Too much. If Racket could utilize luajit’s top-level interface, well, they’ve done all the work of describing the C interfaces for luajit input. It’s basically cut and paste, Racket library to make the translation to its CFFI…done: a pretty serious productivity tool. Could be a GSOC project topic?


capfredf
2019-10-17 15:19:14

Hi @mflatt, I am trying to build Racket-on-Chez in development mode:


capfredf
2019-10-17 15:19:35

I ran ./configure


capfredf
2019-10-17 15:20:06

I got no suitable machine type found try rerunning as ./configure -m=<machine type> available machine types: *


capfredf
2019-10-17 15:20:46

Then I ran ./configure —help:


capfredf
2019-10-17 15:21:03
Available machine types: *

Examples:
  ./configure --machine=i3le

  set machine-type to i3le rather than to determined type

  ./configure --threads --installprefix=/usr/local

  specify threaded version and set installation directory to /usr/local.

capfredf
2019-10-17 15:21:47

BTW, I am on macOS 10.14. What machine type should I use?


mflatt
2019-10-17 15:24:00

The problem is that the instructions don’t mention a bootstrap step, where you need Racket to start building Chez Scheme.


mflatt
2019-10-17 15:25:07

In the ChezScheme directory, you want to run racket <racket-repo>/racket/src/cs/bootstrap/main.rkt


mflatt
2019-10-17 15:26:41

Or raco pkg install cs-bootstrap and then racket -l cs-bootstrap. That assumes that raco and racket is one built in the current Racket repo.


ruyvalle
2019-10-17 17:02:48

@pocmatos @notjack I would also like to follow this conversation


notjack
2019-10-17 17:04:34

it hasn’t started yet but fine by me :simple_smile:


deactivateduser60718
2019-10-17 18:36:53

Hi folks. Here’s an update on integrating Vulkan and Racket: https://sagegerard.com/racket-vulkan-types-done.html


samdphillips
2019-10-17 18:51:19

Exciting. I’ve wanted to work with Vulkan in Racket for a bit now.


deactivateduser60718
2019-10-17 18:52:27

Ditto. I’m looking for feedback on the binding definitions themselves, since this is the first time I’ve used ffi/unsafe.


deactivateduser60718
2019-10-17 19:03:03

@steveh2009 Jay recently introduced me to https://github.com/dbenoit17/dynamic-ffi, which might be of interest to you


samdphillips
2019-10-17 19:23:33

I remember checking out that XML before. You’re a brave individual.


steveh2009
2019-10-17 21:58:17

dynamic-ffi: darn, I’m on Windows 10.