This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() { | |
printf("Hello, World!!"); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$emacs main.c | |
$emcc main.c | |
include<stdio.h> | |
int main() { | |
printf("Hello World!!"); | |
return 0; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mv a.out.js a.out.js.backup | |
$emcc main.c -s NO_EXIT_RUNTIME=0 -s WASM=1 | |
$ls -al | |
total 872 | |
drwxr-xr-x 7 kyorohiro staff 238 12 29 00:41 . | |
drwxr-xr-x 3 kyorohiro staff 102 12 29 00:25 .. | |
-rw-r--r-- 1 kyorohiro staff 98265 12 29 00:41 a.out.js | |
-rw-r--r-- 1 kyorohiro staff 294319 12 29 00:41 a.out.js.backup | |
-rw-r--r-- 1 kyorohiro staff 44476 12 29 00:41 a.out.wasm | |
-rw-r--r-- 1 kyorohiro staff 73 12 29 00:30 main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ emcc main.c -o hello.html -O2 -s WASM=1 | |
$ ls -al | |
total 1000 | |
drwxr-xr-x 10 kyorohiro staff 340 12 29 21:49 . | |
drwxr-xr-x 4 kyorohiro staff 136 12 29 21:39 .. | |
-rw-r--r-- 1 kyorohiro staff 31908 12 29 00:48 a.out.js | |
-rw-r--r-- 1 kyorohiro staff 294319 12 29 00:41 a.out.js.backup | |
-rw-r--r-- 1 kyorohiro staff 24157 12 29 00:48 a.out.wasm | |
-rw-r--r-- 1 kyorohiro staff 102727 12 29 21:49 hello.html | |
-rw-r--r-- 1 kyorohiro staff 31598 12 29 21:49 hello.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python -m SimpleHTTPServer | |
Serving HTTP on 0.0.0.0 port 8000 ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() { | |
printf("Hello World!!\r\n"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ emcc libsqrt.c | |
#include <math.h> | |
int int_sqrt(int x) { | |
return sqrt(x); | |
} | |
$ emacs main.c | |
#include<stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ emcc libsqrt.c -o libsqrt.html -s EXPORTED_FUNCTIONS='["_int_sqrt"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' | |
$ emacs main.html | |
<html> | |
<head> | |
<title>Test</title> | |
</head> | |
<body> | |
<script src="libsqrt.js"></script> | |
<div id="test"></div> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$emacs libtest.c | |
#include <math.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
// | |
// int | |
int int_sqrt(int x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ emacs libtest1.c | |
void add01(int i, char output[]) { | |
output[0] = i+i; | |
} | |
void add02(int i, char* output) { | |
output[0] = i+i; | |
} |
OlderNewer