init.c (647B)
1 #include <Rts.h> 2 #include <pthread.h> 3 #include <stdlib.h> 4 #include "tricu.h" 5 6 static pthread_once_t initialized = PTHREAD_ONCE_INIT; 7 static void initialize(void) { 8 int argc = 1; 9 char name[] = "tricu-embedded"; 10 char *arguments[] = {name, NULL}; 11 char **argv = arguments; 12 RtsConfig config = defaultRtsConfig; 13 config.rts_hs_main = 0; 14 config.rts_opts_enabled = RtsOptsIgnoreAll; 15 config.rts_opts = "-N1 --install-signal-handlers=no"; 16 hs_init_ghc(&argc, &argv, config); 17 } 18 void tricu_init(void) { 19 if (pthread_once(&initialized, initialize) != 0) abort(); 20 } 21 void tricu_buffer_free(uint8_t *buffer) { free(buffer); }