August 2026

Using attribute((weak)) weak symbols in gcc compilation of dynamic library so on Linux system

First explain the code structure: there are three source files, two dynamic library so sources: lib1.c and lib2.c, each exporting one library function (gcc exports by default, unlike Windows msvc which requires explicit dllexport), and one main program source: main.c, which calls the exported functions of the two dynamic libraries, as follows:

lib1.c

#include <stdio.h>

void lib1_func(const char* from)
{
        printf("lib1 func from %s\n", from);
}

lib2.c

#include <stdio.h>

void lib2_func(const char* from)
{
        printf("lib2 func from %s\n", from);
}

main.c

#include <stdio.h>

void lib1_func(const char* from);
void lib2_func(const char* from);

int main()
{
        printf("hello from main\n");
        lib1_func("main");
        lib2_func("main");
        return 0;
}
Continue reading…

Solve the problem of garbled Compile error messages in UE4 under Chinese environment

UE4 4.26.0, VS 2019 Community, and Chinese Win10 20H2 together produced the problem discussed today: when Compile errors occur, the log messages in Chinese are garbled:

I tried switching VS language to English and UE4 language to Chinese, neither worked. I recalled a previous issue: Android Studio的Build Output中文输出乱码(菱形问号)问题的解决方法, and wondered if UE4 had similar settings. After searching without success, I discovered that in newer Win10 (not sure which version first added it) there is a UTF‑8 option in regional language settings. Although in 20H2 it is still labeled beta, it indeed solves the problem:

Continue reading…

Recovering Advanced Save Options in Visual Studio 2017…

In older versions of VS, the File menu had an item called Advanced Save Options, which allowed choosing the text encoding format of source files. After upgrading to 2017 (fresh installation with all default settings), I found this option was gone (Community edition)!

Actually it is just hidden by default, but you can bring it back through the Customize menu function:

Go to Tools → Customize… → Commands → Menu Bar: File → Add Command → File → Advanced Save Options…, then drag it to the position you prefer!

I feel this option should be quite commonly used, so I do not know why it is hidden by default.

Method to compile 32bit programs on 64bit Linux CentOS 7

The method recorded here theoretically applies to all RedHat‑based Linux distributions!
Normally on 64bit Linux (after installing gcc and related tools), compiled executables target the 64bit environment. If you want to compile for 32bit (which can also run on 64bit systems), just add the -m32 option to gcc (for ld there is a corresponding -melf_i386). Although compiling only requires adding the parameter, you still need to install the 32bit versions of the C and C++ standard libraries.

For example, if you compile directly with -m32, you will get the following error:

[kres@localhost test6432]$ gcc -m32 test.c
In file included from /usr/include/features.h:399:0,
from /usr/include/unistd.h:25,
from /usr/include/usb.h:28,
from test.c:1:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h:No such file or directory

# include ;
^
compilation terminated.
Continue reading…

Hard‑mod upgrade of Lenovo Y1S router to 64M flash

Since replacing it with the Redmi AX6000 last October, the Y1S that had served for nearly 10 years finally retired and has since been sitting unused in a box…

Until recently, while browsing the Enshan forum, I accidentally saw a post by user 1421890054: 【2022-1-22】折腾一下OpenWrt-Lenovo-newifi-y1s-R22.1.1-mt7620a-USB, and realized that the Y1S can actually support larger flash chips (the original Winbond 25Q128 is only 16M, and after installing OpenWrt there is basically no room for software…). So I dug out the retired Y1S, planning to try a hard‑mod flash upgrade for fun.

Continue reading…

Method to convert PCB footprints from LCSC EasyEDA to KiCad format

Recently I have been learning EDA, using the open source KiCad. Basic operations are simple, but compared to EasyEDA’s web ecosystem, KiCad’s component symbols and footprints are less convenient. Fortunately I found a method to import EasyEDA PCB footprints into KiCad (borrowed from others, haha). Original post: http://www.taodudu.cc/news/show-5505674.html?action=onClick. Recording here:

When using KiCad, sometimes a footprint is missing and needs to be drawn manually. But drawing is troublesome. Instead, you can download directly from EasyEDA.
First log in to the EasyEDA web version: https://pro.lceda.cn/ and enter the standard version.

Continue reading…

Cherry MX2.0S RGB keyboard LED failure episode three

Following the previous two repair records of Cherry MX2.0S RGB LED failures (see earlier notes: Repair log of Cherry MX2.0S RGB keyboard lighting failure after more than 3 years , Cherry MX2.0S RGB keyboard LED failure repair log again), after about two months another group of keys (Ctrl, Shift, =, F11) developed the same fault:

Because I know this keyboard has the bad LED issue, I often subconsciously press keys repeatedly to trigger the lighting effect and check if any LEDs have died.

This time I caught it in the act, witnessing the entire process of this group of LEDs going from ‘normal to failing’:

Continue reading…