Hi,
Quite some time ago I managed to successfully interface with a C library using FFI. Now I'm having another go, but this time I want to connect to it using native Scheme code. The C library is the interface to a select based TCP socket server, so I figure I should be able to connect to it directly using open-tcp-client and forgo the whole FFI thing.
The way the C library works is that a C struct is sent to the receiving socket first so that it knows the length of the message buffer that will follow and some other information specific to the socket server's operation. This is immediately followed up by the message buffer which is in binary format.
So far... I think I've managed to work out that I should be using u8vector data structure for both the C struct and the message buffer, although I don't yet understand what kind of encoding is going on in there. That will come after I've looked at some examples.
My plan is to extend the existing web-server.scm example to produce a web app that talks to it's relational database using native Scheme. I'm going down this route because I want to extend web-server.scm using the GSI. If I use the FFI I'm restricted to the GSC which prevents the whole interactive development scenario I want where I can keep the browser running, the database running and just stop and start the GSI as I hack code.
What I want to know first though is if I use open-tcp-client inside Gambit's threads will the native Scheme calls out to the external socket server block? If they don't then am I on the right track to use u8vector?
Thanks,
Rob.