Skip to content

Instantly share code, notes, and snippets.

@aidanhs
Created October 23, 2014 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aidanhs/b88dae12fab1e6889414 to your computer and use it in GitHub Desktop.
Save aidanhs/b88dae12fab1e6889414 to your computer and use it in GitHub Desktop.
.PHONY: clean do
CFLAGS=-O0 -m32
EMFLAGS=\
--memory-init-file 0
do: clean x.o y.o z.o
emar rc libtest.a y.o
emar rc libtest.a x.o
emranlib libtest.a
EMCC_DEBUG=2 emcc -s EXPORTED_FUNCTIONS="['_aaa']" $(EMFLAGS) $(CFLAGS) -o out.html z.o libtest.a
clean:
rm -f *.o py/*.o *.a *.js *.html
%.o: %.c
emcc $(CFLAGS) -c -o $@ $<
int init_weakref(int a, int b) {
return a + b;
}
static int init_weakref(void) {
return 150;
}
int testy(void) {
return init_weakref();
}
extern int init_weakref(int, int);
extern int testy(void);
int aaa(void) {
return testy() + init_weakref(5, 6);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment