HMODULE lib = LoadLibrary("foo.dll");
void *p = GetProcAddress(lib, "bar");
// cast p to the approriate function pointer type (fp) and call it
(*fp)(arg1, arg2...);
FreeLibrary(lib);
As already answered, objcopy with the --redefine-sym flag is a good choice in Linux. See, for example, https://linux.die.net/man/1/objcopy for full documentation. It is a little clunky because you are essentially copying the entire library while making changes and every update requires this work to be repeated. But at least it should work.
对于 Linux 和 Windows,重命名名称被别名的库标题中的函数。另一个可行的选项是,在引用新名称的文件中,定义 old _ name new _ name,# 包含导出为别名的库的头,然后在调用者中定义 # undef old _ name。如果有很多文件使用这个库,一个更简单的替代方法是创建一个或多个头文件来包装定义、包含和取消定义,然后使用这个头文件。