xuanjiazhen/cangjielanguage/build
Claude Code and agent skill by xuanjiazhen/cangjielanguage
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install xuanjiazhen/cangjielanguage/buildSKILL.md
The same SKILL.md was published earlier as xuanjiazhen/cangjielanguage/build.
仓颉C互操作配置构建指导
0. 各平台库文件命名对照
| 平台 | 动态库 | 静态库 | |
|---|---|---|---|
| Linux | lib<name>.so | lib<name>.a | |
| macOS | lib<name>.dylib | lib<name>.a | |
| Windows | lib<name>.dll | lib<name>.lib |
注意:Windows 平台上依赖动态库,目前 cjc 和 cjpm 实现有差异:编译时,cjc 对动态库是否有lib前缀不敏感,cjpm 则要求动态库必须有lib前缀。运行时,cjc 编出的可执行文件,依赖的动态库必须加上lib前缀,而 cjpm 构建出的可执行文件,依赖的动态库一定不能有lib前缀。请务必熟悉这个规则(实际是规格问题,未来会修复),保证能正常构建和运行。
1. cjc 编译器链接选项
| 选项 | 说明 | |
|---|---|---|
-L <path> / --library-path <path> | 指定库文件搜索目录(优先级高于 LIBRARY_PATH 环境变量) | |
-l <name> / --library <name> | 链接库文件,格式为 lib[name].[extension](如 -l draw 链接 libdraw.so/.a/.dll) |
2. 使用 cjc 直接编译
2.1 Linux
2.2 macOS
2.3 Windows
注意:Windows 平台上 C 函数需使用__declspec(dllexport)修饰以导出符号。
2.4 安全编译建议
编译 C 代码时应启用栈保护选项,防止缓冲区溢出攻击:
3. 基于 cjpm 项目编译(推荐)
3.1 项目初始化
3.2 cjpm.toml 配置
在 cjpm.toml 中通过 [ffi.c] 节配置 C 库依赖:
3.3 构建与运行
3.4 其他相关 cjpm.toml 配置项
| 配置项 | 说明 | 示例 | |
|---|---|---|---|
output-type | 输出类型 | "executable" / "static" / "dynamic" | |
compile-option | 传给 cjc 的额外编译选项 | "-O1" | |
link-option | 传给链接器的选项 | "-z noexecstack -z relro -z now" |
3.5 不同平台的 cjpm.toml 配置
当需要区分不同目标平台的库路径时,可使用 [target] 节:
Linux x86_64:
macOS aarch64:
Windows x86_64:
3.6 链接安全加固选项
对于需要安全加固的项目,建议在 link-option 中添加链接器安全标志:
| 选项 | 说明 | |
|---|---|---|
-z noexecstack | 禁止栈上执行代码,防止栈溢出攻击 | |
-z relro | 设置 GOT 为只读,防止 GOT 覆写攻击 | |
-z now | 立即绑定所有符号,配合 relro 使用 |
4. 完整示例
4.1 Linux 完整编译流程
4.2 Windows 完整编译流程
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingace_skills/.claude/skills/cangjie_cffi/build/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/xuanjiazhen/cangjielanguage/build)