There is a c file
#include <stdio.h>
#include <termios.h>
struct termios raw;
int raw_on(void)
{
if (tcgetattr(0, &raw) == -1)
return -1;
raw.c_lflag &= ~ECHO;
raw.c_lflag &= ~ICANON;
raw.c_lflag &= ~ISIG;
// raw.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
// raw.c_oflag &= ~(OPOST);
// raw.c_cflag |= (CS8);
// raw.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
// raw.c_cc[VMIN] = 1;
// raw.c_cc[VTIME] = 0;
return tcsetattr(0, TCSAFLUSH, &raw);
}
And when I call it in chez-scheme
> (load-shared-object "./emacs.so")
> (foreign-procedure "raw_on"() int)
#<procedure>
> (define raw-on (foreign-procedure "raw_on"() int))
> (raw-on)
Exception: invalid memory reference. Some debugging context lost
Type (debug) to enter the debugger.
When I search it in internet, I find the termios.h is for POSIX terminal, and my OS is Debian.
May I ask why this bug occurs Thanks in advance.