"use strict";
/*
Given a list of names of functions and symbols, generate C code that define functions
that when called give a pointer to each of these.

For functions, this ensures that these named functions are all placed in the WASM
function table, which makes using them many orders of magnitude faster.

For symbols, it ensures that we have access to them at all (and quickly) so that
the GOTMemHandler (global offset table memory handler) can tell dynamic libraries
where the symbols are in memory.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.alias = void 0;
var MACRO = "\n#ifndef WASM_EXPORT\n#define WASM_EXPORT(x,y) __attribute__((visibility(\"default\"))) void* __WASM_EXPORT__##x() { return &(y);}\n#endif\n";
function wasmExport(names) {
    var v = Array.from(new Set(names)).sort();
    return "".concat(MACRO, "\n\n").concat(v
        .filter(function (func) { return func.trim(); })
        .map(function (func) { return "WASM_EXPORT(".concat(func, ",").concat(func, ")"); })
        .join("\n"));
}
exports.default = wasmExport;
function alias(name, value) {
    return "WASM_EXPORT(".concat(name, ",").concat(value, ")\n");
}
exports.alias = alias;
//# sourceMappingURL=wasm-export.js.map