Skip to content

Commit

Permalink
add shared library documentation (#43)
Browse files Browse the repository at this point in the history
* add docs for loading ckb-lua dynamic library

* add pointer to the dylib tutorial, make dylib example runnable
  • Loading branch information
contrun authored Nov 10, 2022
1 parent d25a7c8 commit 02f594b
Show file tree
Hide file tree
Showing 4 changed files with 546 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DOCKER_EXTRA_FLAGS ?=
BUILDER_DOCKER := nervos/ckb-riscv-gnu-toolchain@sha256:aae8a3f79705f67d505d1f1d5ddc694a4fd537ed1c7e9622420a470d59ba2ec3
PORT ?= 9999

all: lualib/liblua.a build/lua-loader build/libckblua.so build/dylibtest
all: lualib/liblua.a build/lua-loader build/libckblua.so build/dylibtest build/dylibexample

all-via-docker:
docker run --rm -v `pwd`:/code ${BUILDER_DOCKER} bash -c "cd /code && make"
Expand All @@ -29,6 +29,9 @@ lualib/liblua.a:
build/dylibtest: tests/test_cases/dylibtest.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(shell $(CC) --print-search-dirs | sed -n '/install:/p' | sed 's/install:\s*//g')libgcc.a

build/dylibexample: examples/dylib.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(shell $(CC) --print-search-dirs | sed -n '/install:/p' | sed 's/install:\s*//g')libgcc.a

build/lua-loader.o: lua-loader/lua-loader.c
$(CC) -c $(CFLAGS) -o $@ $<

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ make all-via-docker
There are 2 ways to use this project:
1. Embedded

Use `build/libckblua.so` as a shared library. TODO
Use `build/libckblua.so` as a shared library. See [dylib.md](./docs/dylib.md) for a detailed tutorial on how to use `build/libckblua.so`.

2. Standalone(used as script)

Expand Down
Loading

0 comments on commit 02f594b

Please sign in to comment.