From: Greg P. <aer...@ho...> - 2010-07-16 12:39:01
|
Kai, Thanks for the response. I have a few follow up questions about GCC and MSVC runtimes. > From: kti...@go... > > Hello Greg, > > 2010/7/16 Greg Peele <aer...@ho...>: > > I've been taking MinGW-w64 TDM-GCC 4.5 for a spin on my company's code and I > > ran into a problem compiling a third party dependency: CppUnit 1.12. Looks > > like MinGW defines __STDC_SECURE_LIB__ which causes CppUnit to use sprintf_s > > instead of sprintf (and similar functions). However, prototypes for these > > functions aren't visible unless I explicitly define MINGW_HAS_SECURE_API. > > Once that's done, CppUnit compiles but doesn't link due to unresolved > > symbols for sprintf_s and friends. After having some fun with nm and grep I > > gave up because I couldn't figure out which library contained these guys. > > Am I missing something or should I just modify CppUnit to only use these > > functions for MSVC? Personally I don't ever use them but I try to avoid > > changes to third party code if possible. > > Greg Peele > > Yes, the secured API isn't provided in msvcrt's import, as it is not > necessarily part of it. So you need to use msvcr80.dll or higher. We > don't provide the .def files for it at the moment, but you can use the > 'gendef' tool to generate such an import library for it (see our crt > Makefile to see how DLL import libraries can be generated by a .def > file). > > Regards, > Kai > I noticed a libmsvcr80.a (but not libmsvcp80.a) in the x86_64-w64-mingw32\lib directory. Is this not the import library for msvr80.dll? I will try generating one as you suggest. Does GCC embed the manifest to play nicely with Side-by-Side? I've been bitten many times by unexpected patch releases of MSVCR80 installed by Windows Update even just with the MSVC toolchain. My understanding is that the 32-bit msvcrt.dll is basically the VC 6.0 runtime, shipped with Windows since at least Windows XP. Is this true for its 64-bit cousin? Is it safe to mix and match GCC-compiled DLLs that are linked against different msvcrXX.dll runtimes? This is usually unsafe with MSVC because of changes to inline C++ standard library code and class member layout between versions (not a problem for GCC I'd guess) and due to each runtime having its own dynamic memory heap. For example, if I use GCC to compile a DLL linked to msvcr80.dll, would it allocate and deallocate memory in the msvcr80.dll heap, the msvcrt.dll heap, or does GCC have its own heap management? Thanks,Greg -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination |