简单的实现方式,在makefile里加入如下方式

就可以编译出可执行可以执行的SHARED LIBRARY了

# Both shared library and executable
# Note: Option --pie -Wl,-E replaces --shared
ifdef SHARED_OBJECT
CFLAGS += -fPIC
# LDFLAGS += --shared
LDFLAGS += --pie -Wl,-E
OUTFILE = libtoolbox.so
endif</pre></p>