Skip to content

Conversation

@FObersteiner
Copy link
Contributor

@FObersteiner FObersteiner commented May 30, 2024

Fix #64

Since I happen to have a Windows 10 notebook on my desk, I did a quick test of the code on Windows. zig run ... does not work, even when I provide a file with libc paths via the --libc flag. What does work is running the program via a build.zig, where you can link libc with exe.linkLibC().

@jinzhongjia
Copy link
Member

we can use zig build-exe main.zig -lc, on my notebook, it is windows11, I compile it successfully

@FObersteiner
Copy link
Contributor Author

we can use zig build-exe main.zig -lc, on my notebook, it is windows11, I compile it successfully

Great, that also works in zig run ....zig -lc. If that works on a "clean" Windows machine, i.e. no Visual Studio build tools etc. installed, we might add that to the cookbook docs, no?

@jinzhongjia
Copy link
Member

em...this command is actually explained in the official tutorial

@FObersteiner
Copy link
Contributor Author

FObersteiner commented May 31, 2024

em...this command is actually explained in the official tutorial

I was referring to https://cookbook.ziglang.cc/ - sorry if I have overlooked that.

Concerning the PR: I'm having trouble understanding why the CI fails. It seems to be a problem with chapter 14 / databases; on my machine, this fails with

run-all
└─ run examples-14-03
   └─ zig build-exe examples-14-03 Debug native 1 errors
src/14-03.zig:143:40: error: expected type 'bool', found 'u8'
            if (c.mysql_stmt_bind_param(insert_color_stmt, &color_binds)) {
                ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is that related to the UDP example? Did I accidentally use a port that is used by one of the DBs ?

@jinzhongjia
Copy link
Member

The mysql_stmt_bind_param function is a directly referenced c function. Maybe it is because the mysql version on your device is different?

@FObersteiner
Copy link
Contributor Author

The mysql_stmt_bind_param function is a directly referenced c function. Maybe it is because the mysql version on your device is different?

most likely, yes.

IIUC, the problem is that the UDP "server" doesn't get closed automatically after running the example, then CI times out at some point. Didn't check the build.zig... TCP examples are skipped for exactly that reason. Added 04-03 to that list.

Copy link
Member

@jiacai2050 jiacai2050 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jiacai2050 jiacai2050 merged commit b0237f2 into zigcc:main May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network: UDP ?

3 participants