New issue 85 by W.Wilber...@gmail.com: when static link ctemplate, vc
auto create test.lib test.exp with test.exe
http://code.google.com/p/ctemplate/issues/detail?id=85
I want to static link ctemplate, so I write a Makefile(See attachment).
My test file is name test.cpp
I compile it: cl $(CFLAGS) test.cpp
then link:link test.obj libctemplate.lib
The link.exe create:test.exe test.exp test.lib
After search header file, I found template_cache.h have __declspec(dll...).
I modify the header, the issue gone.
Ctemplate version is ctemplate-2.0
Thanks to Issue 67.
Attachments:
Makefile 1.1 KB
template_cache.h.diff 526 bytes
"__declspec(dllexport)" was added to avoid a warning when using the DLL, so
you can't just remove it.
But it is posssible to use *.def export function name? Or add an other
define MACRO? Such as "CTEMPLATE_STATIC".
Another macro might be ok if necessary.
Ugh, sorry for that problem. Olaf is right that I added these to silence a
warning, probably based on advice in the MSDN. This dllimport/export stuff
is all a black art to me.
Olaf's the one in charge these days, so he gets to decide on the best fix!
Just realized I've hit this issue too, didn't know it was due to ctemplate.
I know two way to generate dll *.lib (c dll not c++ dll).
1th: Using lib.exe with *.def file to create *.lib.
2nd: Using __declspec(dllexport) auto create *.lib.
And I only know __declspec(dllexport) to export c++ class.
Just wondering, who is actually using the DLL? Until Windows gets package
management, I prefer static linking.
Static link cost much time for big library(such like
boost,ACE,sqlite3,etc...).
I always using dll for debug, and static link for release.
I don't like dll because there still have chance two dll have same name:(
And many user I know always like one executive file. They don't like setup:)
Maybe better to use *.manifest to find the right dll.