Discussion:
[Gc] Problems with Emscripten
(too old to reply)
Bruce A Henderson
2015-09-29 17:52:10 UTC
Permalink
Raw Message
Hi,

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?


Thanks,

Bruce
Ivan Maidanski
2015-10-01 08:11:21 UTC
Permalink
Raw Message
Git master branch contains support for Emscrpten contributed by Jonathan Chambers.
Hi,
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.
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?
Thanks,
Bruce
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
Loading...