user1092394
user1092394

Reputation: 11

Remove the dependency of a program from certain DLL

I'm writing an application in C, which uses pcre3.dll for regular expression.

The problem is that the program requires pcre3.dll in every client computer I'm trying to run the program on.

How can I remove the dependency of my application from pcre3.dll ?

Upvotes: 1

Views: 148

Answers (1)

Jon
Jon

Reputation: 437504

You need to link to pcre3 statically instead of dynamically as you do now.

If you compile pcre from source, then as the NON-UNIX-USE file states:

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.

Upvotes: 3

Related Questions