-
Notifications
You must be signed in to change notification settings - Fork 16
post: shipping zig libraries with C ABI #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @xhwanlan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求新增了一篇博客文章,旨在为Zig开发者提供一个全面的指南,说明如何在不公开源代码的情况下,通过C应用二进制接口(ABI)分发Zig库。文章详细介绍了如何利用Zig的 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
这篇博文通过对话的形式,清晰地解释了如何使用 Zig 的编译时特性和构建系统来分发二进制库而不泄露源码,这个方法非常巧妙。文章内容翔实,示例代码也很丰富。我发现了一些代码示例中的拼写错误,修正后能让读者更好地理解和复制代码。整体来说,这是一篇高质量的技术分享。
|
|
||
| ```zig | ||
| // lib.zig | ||
| pub const Container = extern struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
container 没必要extern 吧?只是暴露内部字段
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
示例有点问题,如果函数有用相关结构,需要用extern保证内存布局符合C。
|
|
||
| 艾达:编译时收集有些困难。不过办法还是有的,如果`exports`在编译时和生成头文件时是不同的函数是不是就可以解决了。接下来就是zig构建系统的事情,我们要利用其module机制。 | ||
|
|
||
| 艾达:首先我们把项目分成四部分,分别是库本身、编译时导出符号模块、运行生成头文件模块和运行生成头文件的主函数。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能画个图表示这四个模块的关系吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在不能正确渲染mermaid,例如2023-09-05-bog-gc-1。
后来想放截图,发现不知道放images文件夹哪。最后只好放渲染后的svg了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xihale 帮看看呢,按说应该能渲染mermaid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed via #85
No description provided.