我正在用 C 编写一个应用程序,它使用 pcre3.dll 作为正则表达式。
问题是该程序在我尝试运行该程序的每台客户端计算机中都需要 pcre3.dll。
如何删除我的应用程序对 pcre3.dll 的依赖?
最佳答案
您需要静态链接到 pcre3,而不是像现在这样动态链接。
如果您从源代码编译 pcre,则如 NON-UNIX-USE 文件所述:
LINKING PROGRAMS IN WINDOWS ENVIRONMENTS
If you want to statically link a program against a PCRE library in the form of a non-dll .a file, you must define PCRE_STATIC before including pcre.h or pcrecpp.h, otherwise the pcre_malloc() and pcre_free() exported functions will be declared __declspec(dllimport), with unwanted results.
关于c - 去除某个程序对某个DLL的依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8465363/