I omitted one detail: I compiled my library in Visual Studio as C code (/TC). That's why I expected this to work.
Linking with bufferoverflowu.lib gets rid of __security_check_cookie and gshandler.obj supplies __GSHandlerCheck. (As an aside, now that I know what to search for, the results are easy to come by, e.g. http://support.microsoft.com/kb/894573). I'm not sure this is a reasonable solution for my clients, since they would have to get these files from somewhere, and I think gshandler.obj is associated with the VS compiler, not the WinSDK. Now to see whether I can use Microsoft's secure string functions (for example, strcat_s). thanks much, -Dion -----Original Message----- From: Jon [mailto:[email protected]] On Behalf Of JonY Sent: Thursday, January 27, 2011 5:50 PM To: Dock, Dion Cc: [email protected] Subject: Re: [Mingw-w64-public] undefined reference to __GSHandlerCheck -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 1/28/2011 09:29, Dock, Dion wrote: > I've searched and searched for an answer but maybe my Google-fu is weak. > > We produce a library with VS 2005. When I try to link it into a test > program using g++, I get lots of messages like > > ... > > C:\Views\dockd_headers\lip__mgls_nt\mgls_nt\src\release\mgls64.lib(./x64/release/lpclsdll.obj):(.text[?messageBox@@YAXPEAD@Z]+0xcb): > undefined reference to `__security_check_cookie' > > C:\Views\dockd_headers\lip__mgls_nt\mgls_nt\src\release\mgls64.lib(./x64/release/lpclsdll.obj):(.xdata[$unwind$?messageBox@@YAXPEAD@Z]+0xc): > undefined reference to `__GSHandlerCheck' > ... > > If I recompile our library without the "Buffer Security Check" option (/GS-), > then ld.exe crashes after the compile: > > C:\Temp>C:\mingw_64\bin\x86_64-w64-mingw32-g++.exe checkout.cpp > C:\Views\dockd_headers\lip__mgls_nt\mgls_nt\src\release\mgls64.lib -I > C:\Views\dockd_headers\lip__mgls_nt\mgls_nt\src\include > checkout.cpp: In function 'int main()': > checkout.cpp:12:47: warning: deprecated conversion from string constant > to 'char *' > collect2: ld returned 5 exit status > > Any thoughts on where `__GSHandlerCheck' and `__security_check_cookie' are > defined? There has to be a way to link with a Visual Studio created lib. > > thanks, > -Dion Hi, you should never link C++ libraries from different compilers together as they have different ABIs underneath, though C is usually fine. I'm surprised that it even worked. I don't know what __GSHandlerCheck and __security_check_cookie are, possibly found only in MSVC libraries. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (MingW32) iEYEARECAAYFAk1CINUACgkQp56AKe10wHceDgCfd+8im1V+vjcyr6ZM8yQSfzl9 2yIAn1LmLS3Ewef/oK7Aoaj+ai9hKnet =csWK -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
