Bruce A Henderson
2015-09-29 17:52:10 UTC
I have created a C-language generator ( https://github.com/bmx-ng ) for
the programming language BlitzMax ( http://www.blitzmax.com ) in order
to support more platforms.
It successfully uses the Boehm GC on all currently targeted platforms
and architectures (OSX, iOS, Android, Windows, Linux, Pi), except that
is for Emscripten, where everything falls apart.
It appears, given the nature of the errors, that all of my global
variables are being collected. For example, one object pushes output to
stdout, and is working early in the run. However on the next call, it
simply doesn't exist any more.
The variable is declared extern in the header, and like this in the .c :
struct brl_stream_TStream_obj* brl_standardio_StandardIOStream;
This particular object is created with GC_MALLOC_ATOMIC(), and is
assigned a finalizer with GC_REGISTER_FINALIZER().
The modular project consists of many linked archives/static libs, which
produce the final binary.
I am not setting any roots, letting the GC take care of that, as this
works on all the other platforms.
Is there anything specific I should be doing (compile flags, definitions
) for emscripten in order to hang on to my global variable references?