[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: VS2005 Building Against Old Runtime
- From: "steve donovan" <steve.j.donovan@...>
- Date: Wed, 10 Sep 2008 15:39:54 +0200
As promised, here are the files you need to link against msvcrt.dll
http://mysite.mweb.co.za/residents/sdonovan/crt.zip
And this is the command line invocation:
cl /GS- test1.c crt.lib msvcrt.lib kernel32.lib
The /GS- flag switches off stack checks, which prevents us having to link to
_security_cookie, which is part of the new runtime.
This is based on code from the CodeProject article 'Tiny C Runtime Library'
by Mike_V, which is in turn based on Matt Pietrek's LIBCINY.LIB (MSDN
Magazine, 2001).
The idea is to get the minimal startup code necessary, and then link
all the rest
against msvcrt.dll.
http://www.codeproject.com/KB/library/tlibc.aspx
A nmake file for building Lua is included. But for the seriously
impatient, here's a Lua 5.1.2 build done with VS2005 cl, but with no
new runtime dependencies (checked with the depends tool of the Windows
Platform SDK)
http://mysite.mweb.co.za/residents/sdonovan/lua.zip
Regard this as a hack in progress; Lua itself was no problem
whatsoever, but lfs.c put up a fight. There has been a big change in
how things like _findfirst,_findnext and stat and handled. To build
lfs, I needed to make the following changes:
- after the Windows includes:
#undef _findfirst
#undef _findnext
#undef _stat
#undef stat
#define stat _stat32
#undef _finddata_t
#define _finddata_t _finddata32_t
- replace the call to 'stat' with '_stat'.
Have a look at the io.h file of VS2005 to see why these shenanigans
were necessary. It would be cool if _no_ code changes were necessary,
but when the system headers contain so much macro magic, it needs
macro magic to reverse it ;)
I used the VS2005 compiler that comes free with the Platform SDK, but
would imagine that it would not be difficult to persuade the IDE to
use these libraries. VS2008 is left as an exercise for those who
actually have this compiler. I also haven't tried C++, which may have
peculiar demands on the runtime.
steve d.