Closed fare closed 6 months ago
Further examination: its a terminal issue, redirecting stdout makes the problem disappear.
cat > o.scm <<'END'
(c-declare #<<END-C
#include <stdio.h>
#include <openssl/ssl.h>
END-C
)
(c-initialize #<<END-C
int r;
printf("hello, "); fflush(stdout);
r = OPENSSL_init_ssl(0, NULL);
if (r) {
printf("success "); fflush(stdout);
} else {
printf("failure "); fflush(stdout);
}
printf("world\n"); fflush(stdout);
END-C
)
(display "ZZZZZZZZZZZZZZZZ") (newline) (force-output)
END
gsc -o o -exe -ld-options -lssl o.scm && ( echo aaa ; ./o ; echo bbb ; ./o > x ; cat x)
aaa
hello, success world
bbb
hello, success world
ZZZZZZZZZZZZZZZZ
Had issues compiling an executable, wherein linking in libssl causes stdout to disappear(!). To reproduce, create a ssl.ss file with the following contents:
And compile with:
gxc -o ssl -exe ssl.ss && ./ssl
, and it won't display anything. Removing the import and it does print. Redirect./ssl > a
and it works again(!)