Comments (8)
Welcome!
Yeah, we need a page in the documentation for this. For now here's a rough guideline for anyone interested.
At a very minimum your language needs:
- A way to import and export WebAssembly functions.
- The compiler must be configured to import memory. Generally compilers export their own memory by default.
- The memory needs to be sized to an initial size and maximum size of 1 page (64 KB).
- The compiler must be configured to avoid using the lower region of memory reserved by WASM-4.
LLVM-based languages can use these wasm-ld
linker flags to configure the above: --import-memory --initial-memory=65536 --max-memory=65536
, --global-base=6560
and/or -zstack-size=...
.
I think that should be all you need to get a new language running with WASM-4. As a bonus, you can take it even further by including:
- A new project template for
w4 new
. - An output format for
w4 img2src
. - Updated docs on the website.
If you're planning support for a specific language, definitely let us know! It's possible other language X users would be interested and willing to help.
from wasm4.
I think binary will over 65k in scratch for C# =)
from wasm4.
Hello there! May I ask, what language are you planning to support?
The only problem here that if dev would like to add support or definitions for a language from the list, By myself looked into docs but this isn't mentioned...
My guess is you open an issue and discuss with the owner/contributors. Adding a support for a language requires a template (like here).
from wasm4.
I proposed support custom templates for png2src, can be used for generating image source without adding a generator template inside runtime.
from wasm4.
@aduros Thanks! β€οΈ
If had time will try to give Nim or C# a try...
(Though i can't promise with that due to time lack, but if did will reply further and thanks!)
from wasm4.
@eXponenta sad for that...
But that doesn't mean i can't try any another language... π
from wasm4.
@Rabios Hi, I've made a repo that shows how to use WASM-4 from Nim - https://github.com/Yardanico/wasm4nim/. I think after I polish things a bit more and create a nimble project (so that it can be built with a single command) I can add it to the wasm4 repo as a template.
from wasm4.
@Yardanico That's awesome! Please open a PR when you feel it's ready for others to use!
from wasm4.
Related Issues (20)
- tracef should not emit a newline at the end HOT 3
- The online multiplayer system has stalls and halts
- Expose A Portable Web Runtime? HOT 1
- Zig v0.11 breaks w4's build file
- Run-native under Linux: lots of buttons donβt work, and some undocumented ones do HOT 1
- Document embedding carts using a wasm4.org iframe
- Suggestion: display runtime version number on menu HOT 1
- WASM globals are not managed by the netplay synchronization engine HOT 1
- Move games elsewhere
- [Web build] Mouse can be detected outside the screen HOT 3
- Use Go 1.21 WASI GOOS in examples HOT 2
- Start function is not called when DEV_NETPLAY flag is set.
- update zig template HOT 5
- wasm4 project runs on native mode, but doesnt run on browser HOT 1
- Inconsistent Audio Output HOT 2
- WasmGC support? HOT 1
- Correct FPS not being passed to devtools
- Zig template doesn't build HOT 3
- Make `w4 watch` less resource-hungry
- Cut new release? HOT 1
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 wasm4.