The example for embedding racket 3m at 
http://docs.racket-lang.org/inside/embedding.html?q=scheme_build_list#%28part._3m_.Embedding%29
 segfaults during evaluation if compiled by a clang or gcc in a mode which 
disabled the GNU language extensions (e.g. -std=c89 or -std=c++11).

The most immediate cause of the segfault appears to be that 
scheme_current_thread, which on my system expands to 
((&scheme_thread_locals)->scheme_current_thread_), is a null pointer. If I call 
scheme_get_current_thread() in its place (which is the same expression, but 
defined in the racket library and presumably compiled in GNU mode) normal 
evaluation proceeds as expected, but primitive error escapes (such as arise 
from running the program with the argument '(error "foo")') still produce a 
segfault for reasons that are less obvious to me.

What GNU extensions are relied upon, and can this dependency be removed? If the 
issue is just thread local declarations, C11 introduces _Thread_local and C++11 
had thread_local. It'd be nice to be able to compile code that embeds racket in 
a standard mode, as I do with all the rest of my projects.

At the very least, this should probably be called out more clearly in the 
embedding docs. Compiling in a standard mode produces no warnings in any of the 
compilers I've tried, so I spent a long time trying to work out what might have 
been wrong in my code.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to