Comments (3)
I lied, sorry I fixed it.
You can try the above fix, or by running wasm2lua with the nolibc
flag
from wasm2lua.
undefined is not defined
is a user experience bug, this code should be
-this.writeLn(this.outBuf,`local __MALLOC__ = ${malloc ? malloc.id : `function() error "${this.options.webidl.mallocName} is not defined" end`}`);
+this.writeLn(this.outBuf,`local __MALLOC__ = ${malloc ? malloc.id : `function() error "${this.options.webidl.mallocName || "malloc"} is not defined" end`}`);
- hm, uhh, hmm
When I last used this project, malloc was defined and exported alongside whatever program you were compiling to a .wasm
file. The default symbol for malloc
was just simply malloc
. This is because libc
was being compiled into the WASM file too.
Here's what the code was trying to reference
Perhaps you should investigate your wasm
binary - is the malloc
symbol defined and exported there? Is it called something else? If so you should plug the right symbol name into mallocName
. If nothing seems to make sense, perhaps the WASI ecosystem has changed since I last looked at this project.
HOWEVER, it seems like you want a way to use wasm2lua without libc
. I can certainly add a flag to include a stub malloc
in, but that'd mean that I have to dig my hands into a repository that I haven't touched in a while and do scary things to it.
Perhaps what you can try instead is to define your own stub malloc
export in the code you're writing.
extern "C" void* malloc(int size) {
return 0;
}
Something like that should be enough for your troubles.
I hope this.. helps? Unfortunately I'm held up with real life responsibilities and other projects, so I can't do very much here unless things are looking dire.
from wasm2lua.
Awesome, tysm!
from wasm2lua.
Related Issues (20)
- Implement arrays in lua-webidl
- Strings with user defined length in lua-webidl HOT 1
- Comparison Folding
- Implement + Optimize LongInt Division HOT 1
- Optimize JumpStreams
- Don't return from within loops HOT 1
- Optimise `select` opcode with virtual registers
- Optimise allocation of local variables HOT 6
- Implement passing output buffers to c++ via webidl HOT 1
- Consider using a bitvector for lua memory type tracking.
- Optimise br_if boolean casting HOT 1
- Override and inline wasm-implementations of frequently used libc functions with lua-implementations HOT 2
- Graph IR HOT 2
- Code generation without depending on `goto`s HOT 1
- Try that and never works HOT 4
- Zero initialize locals HOT 6
- Failure to install using npm HOT 1
- cannot work on wasm32-unknown-unknown target from rust HOT 5
- Failing to convert seemingly simple C program HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasm2lua.