Skip to content

Instantly share code, notes, and snippets.

@hugoArregui
Created August 27, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugoArregui/7b5626c7dc00f45cdb4ea8721db4f777 to your computer and use it in GitHub Desktop.
Save hugoArregui/7b5626c7dc00f45cdb4ea8721db4f777 to your computer and use it in GitHub Desktop.
Hey guys,
I finally discover the problem, it looks like gtk_init changes the C
locale to use the user one, and since my locale is es_AR.UTF-8, the
strtow function couldn't parse a numeric constant, so this works:
;; test.scm
(import chicken scheme foreign)
#>
#include <gtk/gtk.h>
#include <locale.h>
int main(int argc, char** argv) {
gtk_init(&argc, &argv);
setlocale(LC_NUMERIC, "C"); //<-- this
CHICKEN_run(C_toplevel);
return 0;
}
<#
(print "hey")
(return-to-host)
;;
It looks like CHICKEN requires some specific locale, I wonder if it's
worthy to add an assertion check somewhere? (perhaps on
convert_string_to_number?)
------------------------------------------
I thought that may be useful to have a test case of this problem
without gtk:
;;
(import chicken scheme foreign)
#>
#include <locale.h>
int main(int argc, char** argv) {
setlocale(LC_NUMERIC, "es_AR.UTF-8");
CHICKEN_run(C_toplevel);
return 0;
}
<#
(return-to-host)
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment