Test steps:
- Create a new module hellovalkey.c file under $ValkeyPath/module/hellovalkey folder
hellovalkey.zip
- Create a version.script file
module {
global: RedisModule_OnLoad;
local: *;
};
- Create a Makefile
CC=cc
CFLAGS=-g -O2 -fPIC -Wall -shared
LDFLAGS=
LIBS=
all::
${CC} ${CFLAGS} -I../../src -o hellovalkey.so hellovalkey.c ${LDFLAGS} ${LIBS} -Wl,--version-script=version.script
clean::
rm -f *.so *.o
- compile the module, and we can get hellovalkey.so
- When you load the hellovalkey module, you will get the following error in server side:
433050:M 28 May 2024 15:18:15.582 # Module /home/ubuntu/valkey-oss/module/hellovalkey/hellovalkey.so does not export ValkeyModule_OnLoad() or RedisModule_OnLoad() symbol. Module not loaded.
and you will get the following error in client side:
172.25.0.58:7000> module load /home/ubuntu/valkey-oss/module/hellovalkey/hellovalkey.so
(error) ERR Error loading the extension. Please check the server logs.
- Update the version.script as following:
module {
global: ValkeyModule_OnLoad;
local: *;
};
- compile the hellovalkey module again, and you will get the correct result

Here is the link for what the version.script is https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_25.html
Test steps:
hellovalkey.zip
module {
global: RedisModule_OnLoad;
local: *;
};
CC=cc
CFLAGS=-g -O2 -fPIC -Wall -shared
LDFLAGS=
LIBS=
all::
${CC} ${CFLAGS} -I../../src -o hellovalkey.so hellovalkey.c ${LDFLAGS} ${LIBS} -Wl,--version-script=version.script
clean::
rm -f *.so *.o
433050:M 28 May 2024 15:18:15.582 # Module /home/ubuntu/valkey-oss/module/hellovalkey/hellovalkey.so does not export ValkeyModule_OnLoad() or RedisModule_OnLoad() symbol. Module not loaded.
and you will get the following error in client side:
172.25.0.58:7000> module load /home/ubuntu/valkey-oss/module/hellovalkey/hellovalkey.so
(error) ERR Error loading the extension. Please check the server logs.
module {
global: ValkeyModule_OnLoad;
local: *;
};
Here is the link for what the version.script is https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_25.html