diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-02-01 22:42:55 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-02-01 13:42:55 -0800 |
commit | c81857a3a7708738b20bb28a320fc971e74626a7 (patch) | |
tree | a0e933a2d21384fc84fef0d6ee9f2e44764387a4 /src/binaryen-c.h | |
parent | 6bc97008eca2f8776f6fe4d480f3227d2a05a7c5 (diff) | |
download | binaryen-c81857a3a7708738b20bb28a320fc971e74626a7.tar.gz binaryen-c81857a3a7708738b20bb28a320fc971e74626a7.tar.bz2 binaryen-c81857a3a7708738b20bb28a320fc971e74626a7.zip |
Fix hard-wired buffer limit in the JS API (#1394)
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r-- | src/binaryen-c.h | 14 |
1 files changed, 14 insertions, 0 deletions
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); |