summaryrefslogtreecommitdiff
path: root/src/binaryen-c.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r--src/binaryen-c.h14
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);