summaryrefslogtreecommitdiff
path: root/byterun/extern.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/extern.c')
-rw-r--r--byterun/extern.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/byterun/extern.c b/byterun/extern.c
index a8e367f185..f27a95844c 100644
--- a/byterun/extern.c
+++ b/byterun/extern.c
@@ -144,6 +144,13 @@ static void init_extern_output(void)
extern_limit = extern_output_block->data + SIZE_EXTERN_OUTPUT_BLOCK;
}
+static void close_extern_output(void)
+{
+ if (extern_userprovided_output == NULL){
+ extern_output_block->end = extern_ptr;
+ }
+}
+
static void free_extern_output(void)
{
struct output_block * blk, * nextblk;
@@ -465,7 +472,7 @@ static intnat extern_value(value v, value flags)
/* Marshal the object */
extern_rec(v);
/* Record end of output */
- extern_output_block->end = extern_ptr;
+ close_extern_output();
/* Undo the modifications done on externed blocks */
extern_replay_trail();
/* Write the sizes */