WASM:

https://github.com/Hanks10100/wasm-examples/tree/master/simple

mkdir hello
cd hello
echo '#include <stdio.h>' > hello.c
echo 'int main(int argc, char ** argv) {' >> hello.c
echo 'printf("Hello, world!\n");' >> hello.c
echo '}' >> hello.c
emcc hello.c -s WASM=1 -o hello.html

printf '#include<iostream> \nint main() { std::cout<<"hello world"<<std::endl; return 0;}' > helloworld.cpp

docker run --rm -v $(pwd):/src trzeci/emscripten emcc helloworld.cpp -o helloworld.html

docker run --rm -v $(pwd):/src trzeci/emscripten emcc math.c -Os -s WASM=1 -s SIDE_MODULE=1 -o math.wasm

python3 -m http.server 8080 #此时打开localhost:8080即可看到相应页面

emcc math.c -Os -s WASM=1 -s SIDE_MODULE=1 -o math.wasm

https://github.com/Hanks10100/wasm-examples
https://blog.csdn.net/liuyan19891230/article/details/79144332
https://segmentfault.com/a/1190000008402872

emcc,wasm,webassembly的更多相关文章

  1. 如何生成WebAssembly文件?

    许多3D游戏都是用C/C++语言写的,如果能将C/C++语言编译成JavaScript代码,它们不就能在浏览器里运行了吗?Emscripten的底层是LLVM编译器,Emscripten可以将c/c+ ...

  2. WASM

    WASM WebAssembly https://webassembly.org/ https://github.com/appcypher/awesome-wasm-langs https://me ...

  3. 在kubernetes上运行WASM负载

    在kubernetes上运行WASM负载 WASM一般用在前端业务中,但目前有扩展到后端服务的趋势.本文使用Krustlet 将WASM服务部署到kubernetes. 简介 Krustlet 是一个 ...

  4. WebAssembly正逐渐成为FaaS的主力

    相信很多人都知道PaaS(平台即服务)和IaaS(基础设施即服务).而随着云计算时代的发展,逐渐出现了大量的XaaS形式的概念,这些技术从原先的硬件服务器,虚拟化服务,再到容器化逐渐转变.使得软件发布 ...

  5. 试试将.NET7编译为WASM并在Docker上运行

    之前有听到说Docker支持Wasmtime了,刚好.NET7也支持WASM,就带大家来了解一下这个东西,顺便试试它怎么样. 因为WASM(WebAssembly) 一开始是一个给浏览器的技术,比起J ...

  6. shell 中长命令的换行处理

    考察下面的脚本: emcc -o ./dist/test.html --shell-file ./tmp.html --source-map-base dist -O3 -g4 --source-ma ...

  7. Linux 一条长命令占用多行

    前言 考察下面的脚本: ? 1 emcc -o ./dist/test.html --shell-file ./tmp.html --source-map-base dist -O3 -g4 --so ...

  8. Istio中的流量配置

    Istio中的流量配置 目录 Istio中的流量配置 Istio注入的容器 Istio-init istio-proxy Envoy架构 Pilot-agent生成的初始配置文件 Envoy管理接口获 ...

  9. 【一月一本技术书】-【Go语言设计与实现】- 9月

    Go : 2009.11.10 代表作:Docker.k8s.etcd 模仿C语言,目标:互联网的C语言 讲的晦涩难懂....硬板..放弃了好几次才读完.满分10分,打6分. 下个月:Python数据 ...

随机推荐

  1. GridView不执行RowCommand事件

    web.config里把viewstate禁用了.如果是的话在页面里单独开起来就好了. <%@ Page Title="" Language="C#" M ...

  2. SQL递归方式实现省市区县级别查询

    数据库脚本 CREATE TABLE [dbo].[Std_Area]( [Id] [int] NOT NULL, [Name] [nvarchar](50) NULL, [ParentId] [in ...

  3. 【教程】Win7-64位安装OpenSSL详细过程

    1.下载ActivePerl  5.24.0.2400 http://www.activestate.com/activeperl/downloads 图片:ActivePerl-5.24.0.240 ...

  4. name转json

    ^(\{)?(?<=\n)(.*)(\})?$ "$2":"", UserId UserOrderId ChargeAccount BuyNum Good ...

  5. 通过java实现解压zip,rar的代码

    package com.zuidaima.main; import java.io.File; import java.io.FileInputStream; import java.io.FileO ...

  6. centos7 nginx Failed to read PID from file /run/nginx.pid: Invalid argument 解决方法

    笔者在centos7上,配置nginx代理服务后, systemctl status nginx.service 提示错误 Failed to read PID from file /run/ngin ...

  7. SpringBoot------自定义拦截器

    1.添加pom.xml使用的依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="htt ...

  8. Oracle 11G 安装文档

    一. 将文件win32_11gR2_database_1of2.zip和win32_11gR2_database_2of2.zip解压. 注意:这两个文件解压到同一个目录下,即:将Components ...

  9. TIJ -- CountDownLatch

    1. 2. Class : CountDownLatchDemo package lime.thinkingInJava._021._007._001; import java.sql.Time; i ...

  10. python使用requests发送application/x-www-form-urlencoded请求数据

    def client_post_formurlencodeddata_requests(request_url,requestJSONdata): #功能说明:发送以form表单数据格式(它要求数据名 ...