1

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 ?

Darren Burgess
  • 4,200
  • 6
  • 27
  • 43
  • 1
    possible duplicate of [Deploying C app that uses the PCRE library](http://stackoverflow.com/questions/1343859/deploying-c-app-that-uses-the-pcre-library) – HostileFork says dont trust SE Dec 11 '11 at 16:09
  • You can get the static lib [here](http://www.psyon.org/projects/pcre-win32/), the files ending with `-static.zip`. – Andre Dec 11 '11 at 16:11
  • Not a dupe IMO: the other question is targeted at *nix and also does not offer any specific instructions. – Jon Dec 11 '11 at 16:13
  • +1 to @HostileFork, IMO it's a duplicate, only the platform is different. – Andre Dec 11 '11 at 16:19
  • @Jon The theory (though not necessarily an effective practice) is that noticing commonality in questions will lead them to link together. This draws attention to the older question so it gets brought up to date wiki-style, and becomes an even better resource instead of suffering the dreaded web rot. Conventions still evolving, though... http://blog.stackoverflow.com/2010/11/dr-strangedupe-or-how-i-learned-to-stop-worrying-and-love-duplication/ – HostileFork says dont trust SE Dec 11 '11 at 16:25

1 Answers1

3

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.

Jon
  • 428,835
  • 81
  • 738
  • 806