Skip to content

Commit

Permalink
Remove most exported functions from generated JavaScript
Browse files Browse the repository at this point in the history
This is currently done in an blunt way via awk.
Proper solution would be for Emscripten to have a way to expose two layers: C[++] functions that needs to be externally visible to other dlopened modules and C[++] functions that needs to be exposed to the JS side
  • Loading branch information
carlopi authored and Mytherin committed Jan 17, 2024
1 parent 059228f commit f25219d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/wasm_build_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ emmake make \
-j${CORES} \
duckdb_wasm

npm install -g js-beautify
js-beautify ${BUILD_DIR}/duckdb_wasm.js > ${BUILD_DIR}/beauty.js
awk '!(/var .*wasmExports\[/) || /var _duckdb_web/ || /var _main/ || /var _malloc/ || /var _free/ || /stack/' ${BUILD_DIR}/beauty.js > ${BUILD_DIR}/duckdb_wasm.js

cp ${BUILD_DIR}/duckdb_wasm.wasm ${DUCKDB_LIB_DIR}/duckdb${SUFFIX}.wasm
sed \
-e "s/duckdb_wasm\.wasm/.\/duckdb${SUFFIX}.wasm/g" \
Expand Down

0 comments on commit f25219d

Please sign in to comment.