Linking

Tom Younger <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Hi there.

I have a question about linking.

I would like to link the Expat library statically.  When I link to the
Linux libraries, this happens properly, however when I link my project
under Windows, I can only get the program to work if I include the path to
the libexpat.dll in my system path.

Even though I include StaticLibs\libexpatMT.lib in my link command, without
Libs\libexpat.lib, it can't resolve some symbols.  It appears as though
libexpat.lib loads the DLL at run-time.

The problem I have is that the project I am working on is expected to be
able to run without setting any environment variables prior to executing
(it does that itself at run-time), and with all software components
self-contained in its own install folder.  The way I currently have things
working the DLL is loaded at program startup, prior to being able to set
the path at run-time to allow a local copy of the DLL to be loaded.

The relevant portion of my current Makefile is included below:

#### Expat
EXPAT_HOME      =       V:\lib\Expat-2.0.0
INCLUDE_EXPAT   =       -I$(EXPAT_HOME)\include
LDFLAGS_EXPAT   =       /LIBPATH:$(EXPAT_HOME)
LIB_EXPAT       =       $(LDFLAGS_EXPAT)\Libs libexpat.lib
$(LDFLAGS_EXPAT)\StaticLibs libexpatMT.lib

I've been unable to find any mention of this in any of the documentation
I've found.  Like I said, my Makefile for Linux works just as expected and
links statically just fine.

---
Tom Younger, B.Sc.
Lead Engineer, Marine Division
Quester Tangent
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.