There are few recipes floating around how to do that, but they
generally fail if you use _getpid() or _environ/_wenviron in your
application.
First thing to do is to install the Windows Driver Development Kit.
I used the latest one (7.1) and if using x86 the libs are in
C:\WinDDK\7600.16385.1\lib\Crt\i386
Since I don't use GUI, I just add that to the INCLUDE env,
but with GUI, modifying the IDE lib search path should
be enough.
Next thing is to update the msvcrt.lib with the missing symbols.
Don't wish to speculate on the reason why Microsoft didn't
export those, but anyhow ...
Open VS 2008 command prompt and cd to
>cd C:\WinDDK\7600.16385.1\lib\Crt\i386
>copy msvcrt.lib msvcrt.lib.bak
>notepad msvcrt0.def
Copy paste the following and save.
LIBRARY msvcrt
EXPORTS
_getpid
_environ
_wenviron
>lib /NODEFAULTLIB /DEF:msvcrt0.def /MACHINE:X86 /OUT:msvcrt0.lib
>lib msvcrt.lib msvcrt0.lib
You'll see bunch of warnings, but that's actually OK, cause they
mean that original symbols have been preserved.
Now you have a complete msvcrt.lib that links to msvcrt.dll
instead to the msvcr90.dll solving the famous .dll hell.
All you need is to add
C:\WinDDK\7600.16385.1\lib\wxp\i386\msvcrt_winxp.obj
file to your .dll or .exe project.
Note that merging msvcrt0.lib to msvcrt.lib can be avoided
by just adding msvcrt0.lib to the list of project's
include libraries
Have fun ;)
Regards
--
TM