xiaowanmay / googletest

Automatically exported from code.google.com/p/googletest
0 stars 0 forks source link

ask a question about compiling googletest into dll file #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I just want to ask a simple question about making googletest into dll. I 
use VS2003 and gtest-md.sln to do the job. The macro 
GTEST_CREATE_SHARED_LIBRARY has been defined. However when I test the 
gtest.dll and gtest.lib by using the simple assertion EXPECT_FALSE(true) 
and EXPECT_EQ(1,2), there's some heap error: 
File: dbgheap.c 
Line: 1132
_CrtIsValidHeapPointer error

I've checked the Run-time library and they are /MDd for the dll 
compilation and /MTd for test exe compilation. So I don't know what would 
probably cause such kind of problem. Could you please reply to me if you 
know the answer? The configuration of the VS project is listed below:
cl.exe: /Od /I "E:\gtest-1.5.0" /I "E:\gtest-1.5.0
\include" /D "WIN32" /D "_DEBUG" /D "_DLL" /D "DLL_EXPORT_GTEST" /D "_WINDL
L" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Fo"gtest-md/Debug/gtest-md/" /Fd"gtest-
md/Debug/gtest-md/vc70.pdb" /W3 /nologo /c /ZI /Gd /TP
Link.exe: /OUT:"gtest-md/Debug/gtest-
md.dll" /NOLOGO /DLL /DEBUG /PDB:"gtest-md/Debug/gtest-md.pdb"   
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib 
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Thanks.

Best Regards

Original issue reported on code.google.com by sunnybea...@gmail.com on 13 May 2010 at 2:13

GoogleCodeExporter commented 9 years ago
Issue tracker is not the way to ask questions; we have have a mailing list for 
that. You will have your questions 
answered faster there.

As for your problem, once you use /MD(d) in one of your modules, you have to 
use it everywhere, including your 
test .exe.

Original comment by vladlosev on 16 May 2010 at 6:11