ddavis2speedray / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Google Test does not support compiling into Windows DLL - I have a patch #214

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some 3rd party libraries come only in DLL form.  If another library (the
one I am developing) uses the 3rd party DLL, and uses google test in any way,
it either has to be DLL (thus google test has to be DLL) or
you get link errors when linking the executable, due to multiply-defined
symbols that are being brought in by static google-test library.

What version of the product are you using? On what operating system?
Windows XP, Visual Studio 9 (2008).

I have a patch for google test 1.3.0
that introduces DLL_EXPORT_XXX macros in most include files
to be able to generate working DLL on windows.
It is attached

Original issue reported on code.google.com by lennypri...@gmail.com on 3 Nov 2009 at 9:04

Attachments:

GoogleCodeExporter commented 9 years ago
Google Test does not currently support as a DLL. You can look at this 
discussion for 
rationale: 
https://groups.google.com/group/googletestframework/browse_thread/thread/4e85c7
e69e3e5dce?tvc=2.

Original comment by vladlosev on 12 Nov 2009 at 9:50

GoogleCodeExporter commented 9 years ago
Please update the status of this so i can work on a patch for svn trunk.
thank you!

Original comment by lennypri...@gmail.com on 17 Nov 2009 at 5:53

GoogleCodeExporter commented 9 years ago

Original comment by vladlosev on 17 Nov 2009 at 7:39

GoogleCodeExporter commented 9 years ago
I have uploaded the patch for the latest trunk according to the documentation.
I worked really hard on it and tested it 8 ways to Sunday, on multiple 
platforms,
so anticipate few, if any problems.

Original comment by lennypri...@gmail.com on 24 Nov 2009 at 6:04

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/160050/show

Original comment by lennypri...@gmail.com on 24 Nov 2009 at 7:47

GoogleCodeExporter commented 9 years ago
Vlad's patch works.
Couple of comments
- Still would like a separate .vcproj/.sln files for building
DLL on visual studio
- Generally, the convention for naming DLLs on windows
would be gtest.dll (for release) and gtestd.dll (for debug)
or gtestmdd/gtestmd (for multithreaded-dll, multithreaded-debug-dll)
I would like to see either of these name schemes as opposed to _dll scheme.
looks kinda ugly _dll.dll

Original comment by lennypri...@gmail.com on 18 Dec 2009 at 3:37

GoogleCodeExporter commented 9 years ago
FYI: GCC turns out to support this as well:  
http://gcc.gnu.org/wiki/Visibility. 
Thanks to Manuel Klimek for the link.

Original comment by vladlosev on 29 Jan 2010 at 7:23

GoogleCodeExporter commented 9 years ago
Changed the priority to high - we want this in the next release if possible.

Original comment by w...@google.com on 4 Feb 2010 at 8:13

GoogleCodeExporter commented 9 years ago
I was able to build the DLL using scons (the change was in r354) - thanks for 
the
fix! I'm curious, does the resolution of this issue have any bearing on the snag
described at
http://code.google.com/p/googletest/wiki/GoogleTestPrimer#Important_note_for_Vis
ual_C++_users
; namely, the failure to link unreferenced test libraries? I'm wondering in
particular whether the test macros can automatically decorate the appropriate
declarations with __declspec() for DLL libraries.

Original comment by hbc...@gmail.com on 12 Feb 2010 at 12:53

GoogleCodeExporter commented 9 years ago
It appears that of the two testing::InitGoogleTest() signatures, the one 
supporting
wchar_t isn't being exported.

Original comment by hbc...@gmail.com on 12 Feb 2010 at 8:35

GoogleCodeExporter commented 9 years ago
Fixed in the trunk.

Original comment by w...@google.com on 6 Mar 2010 at 5:57

GoogleCodeExporter commented 9 years ago
To build as a DLL, I needed to set the configuration to "Dynamic Library", and 
add a
preprocessor definition "GTEST_CREATE_SHARED_LIBRARY=1".

Original comment by hbc...@gmail.com on 14 Mar 2010 at 12:38