3dgen / cppwasm-book Goto Github PK
View Code? Open in Web Editor NEW:books: WebAssembly friendly programming with C/C++ -- Emscripten practice
:books: WebAssembly friendly programming with C/C++ -- Emscripten practice
emcc 2.0.13版本
使用 Pointer_stringify() 会报错 Pointer_stringify is not defined (使用第五章例子 websocket)
可用UTF8ToString替换
In the end of Chapter2 Section 2.5, the example output img error(It seems use the section 2.4.1 example)
https://3dgen.cn/cppwasm-book/zh/ch2-c-js/ch2-05-em-asm.html
hi,
Please can i use this book for free ?
Thanks.
有时候不挂代理pull 得特别慢。。
运行example\ch3\03的nodefs.js时报错:
node nodefs.js
Debugger attached.
exception thrown: NODEFS is no longer included by default; build with -lnodefs.js
如果能帮忙解决,十分感谢!
Hi,
Will you translate these documents in english ? It would be very pleasant. i'm interested in the subject but I don't understand what you say about it.
Thank you for your reply.
几个有意思的例子(基于asm.js):
抽奖规则的设计原则:
收集参与抽奖的人
抽奖的流程
[0-9a-zA-Z-_]
等字符组成,1-32个字符),也可以用自己的账号(如果用户如果担心泄密,也可以公布MD5)补充点:
abc:sdfsd
生成的MD5, abc是幸运号,冒号后面是salt下面是抽奖算法的例子,种子字符串是wasm,2各参与者:
// Copyright 2018 [email protected]. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"hash/crc32"
"sort"
)
func main() {
luckyStar := MakeLuckyStar("wasm", map[string]string{
"chai2010": "chai2010",
"ending": "ending",
})
fmt.Println(luckyStar)
// output: ending
}
func MakeLuckyStar(seed string, luckyTokens map[string]string) string {
var (
crc32Sum = uint64(crc32.ChecksumIEEE([]byte(seed)))
sortedKeys = make([]string, 0, len(luckyTokens))
)
for id, tok := range luckyTokens {
crc32Sum += uint64(crc32.ChecksumIEEE([]byte(tok)))
sortedKeys = append(sortedKeys, id)
}
sort.Strings(sortedKeys)
idx := int(crc32Sum) % len(luckyTokens)
return sortedKeys[idx]
}
真的很开心有**人在深入搞webassmebly,现在想请教一个问题:
我工程中有两个库a.h和b.h这两个都是第三方库,我现在又写了一个c.h引用了这两个库,并且都已经调通了,但是我在使用webassmebly打包c.h时候遇见了问题,我不知道如何让它找到a.h和b.h。
感谢您能回复。
两位作者你们好:
最近在看这本书,里面没有提供源代码链接,部分章节和这个代码库的内容和example路径下的文件不对应,不知道作者大大有没有兴趣提供一个代码库链接方便同学们编译和运行。
怎么做才能支持输入法,进而能输入中文呢?
您好,我是书栈网( https://www.bookstack.cn )站长,最近在收集查找和分享WebAssembly的学习资料,看到了您创作的《C/C++面向WebAssembly编程》托管在github上,由于并未看到 CC 协议,所以在此申请,希望能够将该优质的内容转载分发到网站上,方便更多的用户使用和阅读。我们的转载会遵循 知识共享-署名-非商用
的知识共享协议。
this function has been removed - you should use UTF8ToString(ptr, maxBytesToRead) instead!
hello.js:2400 this function has been removed - you should use UTF8ToString(ptr, maxBytesToRead) instead!
abort @ hello.js:2400
Pointer_stringify @ hello.js:806
Module.onRuntimeInitialized @ app.js:3
doRun @ hello.js:2309
run @ hello.js:2326
runCaller @ hello.js:2275
removeRunDependency @ hello.js:1535
receiveInstance @ hello.js:1653
receiveInstantiatedSource @ hello.js:1670
Promise.then (async)
(anonymous) @ hello.js:1691
Promise.then (async)
instantiateAsync @ hello.js:1689
createWasm @ hello.js:1716
Module.asm @ hello.js:1740
(anonymous) @ hello.js:2082
app.js:6 Uncaught (in promise) abort(this function has been removed - you should use UTF8ToString(ptr, maxBytesToRead) instead!) at Error
at jsStackTrace (http://127.0.0.1:8080/output/hello.js:1808:17)
at stackTrace (http://127.0.0.1:8080/output/hello.js:1825:16)
at abort (http://127.0.0.1:8080/output/hello.js:2406:44)
at Pointer_stringify (http://127.0.0.1:8080/output/hello.js:806:3)
at Object.Module.onRuntimeInitialized (http://127.0.0.1:8080/app.js:3:3)
at doRun (http://127.0.0.1:8080/output/hello.js:2309:71)
at run (http://127.0.0.1:8080/output/hello.js:2326:5)
at runCaller (http://127.0.0.1:8080/output/hello.js:2275:19)
at removeRunDependency (http://127.0.0.1:8080/output/hello.js:1535:7)
at receiveInstance (http://127.0.0.1:8080/output/hello.js:1653:5)
Module.onRuntimeInitialized @ app.js:6
doRun @ hello.js:2309
run @ hello.js:2326
runCaller @ hello.js:2275
removeRunDependency @ hello.js:1535
receiveInstance @ hello.js:1653
receiveInstantiatedSource @ hello.js:1670
Promise.then (async)
(anonymous) @ hello.js:1691
Promise.then (async)
instantiateAsync @ hello.js:1689
createWasm @ hello.js:1716
Module.asm @ hello.js:1740
(anonymous) @ hello.js:2082
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.