feat: add ffi c

This commit is contained in:
2020-12-27 15:09:31 +08:00
parent 784be79abf
commit f0958ac291
5 changed files with 57 additions and 0 deletions

16
__ffi/c2/Makefile Normal file
View File

@@ -0,0 +1,16 @@
.PHONY: clean
libcfunctions.so: cfunctions.o
${CC} --shared -o $@ $<
cfunctions.o: cfunctions.h cfunctions.c
${CC} -fPIC -o $@ -c cfunctions.c -I.
something: something.rs libcfunctions.so
rustc -L. -lcfunctions something.rs -C link-arg='-Wl,-rpath,${PWD}'
@# The command below can be used if the library to link with is
@# specified in something.rs.
@#rustc -L. something.rs -C link-arg='-Wl,-rpath,${PWD}'
clean:
${RM} libcfunctions.so cfunctions.o something