From 2d73d07923dc40022353dcc8a602ef80e490e97e Mon Sep 17 00:00:00 2001 From: Dexoron Date: Tue, 7 Jul 2026 11:21:30 +0800 Subject: [PATCH] New translations library-project.mdx (Polish) [ci skip] --- .../docs/recipes/library-project.mdx.mdx | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docs-crowdin-export/pl-PL/docs/recipes/library-project.mdx.mdx diff --git a/docs-crowdin-export/pl-PL/docs/recipes/library-project.mdx.mdx b/docs-crowdin-export/pl-PL/docs/recipes/library-project.mdx.mdx new file mode 100644 index 0000000..336c122 --- /dev/null +++ b/docs-crowdin-export/pl-PL/docs/recipes/library-project.mdx.mdx @@ -0,0 +1,70 @@ +--- +sidebar_label: Library project +--- + +# Library Project + +Creating a static library and using it in another project. + +## Step 1: Create the library + +```bash +dcr new my-lib +cd my-lib +``` + +`dcr.toml`: + +```toml +[package] +name = "my-lib" +version = "0.1.0" +type = "none" + +[build] +language = "c" +standard = "c11" +kind = "staticlib" +``` + +`src/my_lib.h`: + +```c +#ifndef MY_LIB_H +#define MY_LIB_H +int add(int a, int b); +#endif +``` + +`src/my_lib.c`: + +```c +#include "my_lib.h" +int add(int a, int b) { return a + b; } +``` + +## Step 2: Build + +```bash +dcr build --release +``` + +Artifacts: + +* `target/\/release/libmy-lib.a` (Linux) +* `target/release/my-lib.lib` (Windows) +* `target/include/` — header files + +## Step 3: Use in another project + +```bash +dcr new my-app +cd my-app +dcr add my-lib ../my-lib +``` + +Automatically: + +* Adds include path to `target/include/` of the library +* Adds lib path to `target/\/release/` +* Links `libmy-lib.a` / `my-lib.lib`