Add example of static linking

Qi Wang
2023-08-08 14:42:37 -07:00
parent 25094cd745
commit 9cd53384f1
+6
@@ -18,6 +18,12 @@ There are several ways to integrate jemalloc into an application. Here are some
cc app.c -o app -L`jemalloc-config --libdir` -Wl,-rpath,`jemalloc-config --libdir` -ljemalloc `jemalloc-config --libs`
```
* Link jemalloc **statically** into the application at build time, and use it as a generic non-replaceable malloc implementation:
```sh
cc app.c -o app `jemalloc-config --libdir`/libjemalloc.a `jemalloc-config --libs`
```
* Compile jemalloc with an API prefix (see the `--with-jemalloc-prefix` configure option), link with jemalloc at build time as above, but use jemalloc distinctly from the system allocator.
Once you have jemalloc integrated into your application, you can use special features in a variety of ways: