From 9aaf026e13fcd70568bc68dd21e4f26cb5a7a837 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 21 Apr 2026 15:01:25 +0300 Subject: [PATCH] db.mysql: fix no output on windows when using mysql lib (fixes #14464) --- vlib/db/mysql/README.md | 18 +++++++++--------- vlib/db/mysql/_cdefs_windows.c.v | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vlib/db/mysql/README.md b/vlib/db/mysql/README.md index 9382dd85a..2a0f209fa 100644 --- a/vlib/db/mysql/README.md +++ b/vlib/db/mysql/README.md @@ -28,19 +28,19 @@ For FreeBSD, you need to install the `mariadb118-client` package. For OpenBSD, you need to install the `mariadb-client` package. -For Windows, install [the installer](https://dev.mysql.com/downloads/installer/) , -then copy the `include` and `lib` folders to `\thirdparty\mysql`. +For Windows, install [the installer](https://dev.mysql.com/downloads/installer/) or extract the +ZIP package, then copy the `include`, `lib`, and `bin` folders to +`\thirdparty\mysql`. ### Troubleshooting -If you encounter weird errors (your program just exits right away, without -printing any messages, even though you have `println('hi')` statements in your -`fn main()`), when trying to run a program that does `import db.mysql` on windows, you -may need to copy the .dll file: `thirdparty/mysql/lib/libmysql.dll`, into the folder -of the executable too (it should be right next to the .exe file). +If a program that imports `db.mysql` exits right away on Windows before +`fn main()` prints anything, Windows usually could not load `libmysql.dll`. +Make sure that `thirdparty/mysql/bin` and `thirdparty/mysql/lib` are on `PATH`. +If you still need a workaround, copy `libmysql.dll` next to the produced `.exe`. -This is a temporary workaround, until we have a more permanent solution, or at least -more user friendly errors for that situation. +One common sign of this problem is the process exit code `-1073741515` +(`0xC0000135`). ## Basic Usage diff --git a/vlib/db/mysql/_cdefs_windows.c.v b/vlib/db/mysql/_cdefs_windows.c.v index 96ab75425..b8accaac8 100644 --- a/vlib/db/mysql/_cdefs_windows.c.v +++ b/vlib/db/mysql/_cdefs_windows.c.v @@ -8,4 +8,4 @@ $if tinyc { #flag windows @VEXEROOT/thirdparty/mysql/lib/libmysql.lib } -#include # Please install https://dev.mysql.com/downloads/installer/ , then put the include/ and lib/ folders in thirdparty/mysql. Do not forget to add thirdparty/mysql/bin and thirdparty/mysql/lib to PATH +#include # Please install https://dev.mysql.com/downloads/installer/ , then copy the include, lib, and bin folders to thirdparty/mysql. Make sure thirdparty/mysql/bin and thirdparty/mysql/lib are on PATH, or copy libmysql.dll next to the produced .exe -- 2.39.5