From c81857a3a7708738b20bb28a320fc971e74626a7 Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Thu, 1 Feb 2018 22:42:55 +0100 Subject: Fix hard-wired buffer limit in the JS API (#1394) --- src/binaryen-c.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/binaryen-c.h') diff --git a/src/binaryen-c.h b/src/binaryen-c.h index 9033a6950..87c44db60 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -707,6 +707,20 @@ typedef struct BinaryenBufferSizes { // @returns how many bytes were written. This will be less than or equal to outputSize BinaryenBufferSizes BinaryenModuleWriteWithSourceMap(BinaryenModuleRef module, const char* url, char* output, size_t outputSize, char* sourceMap, size_t sourceMapSize); +// Result structure of BinaryenModuleAllocateAndWrite. Contained buffers have been allocated +// using malloc() and the user is expected to free() them manually once not needed anymore. +typedef struct BinaryenModuleAllocateAndWriteResult { + void* binary; + size_t binaryBytes; + char* sourceMap; +} BinaryenModuleAllocateAndWriteResult; + +// Serializes a module into binary form, optionally including its source map if +// sourceMapUrl has been specified. Uses the currently set global debugInfo option. +// Differs from BinaryenModuleWrite in that it implicitly allocates appropriate buffers +// using malloc(), and expects the user to free() them manually once not needed anymore. +BinaryenModuleAllocateAndWriteResult BinaryenModuleAllocateAndWrite(BinaryenModuleRef module, const char* sourceMapUrl); + // Deserialize a module from binary form. BinaryenModuleRef BinaryenModuleRead(char* input, size_t inputSize); -- cgit v1.2.3