George V. Reilly's Technical Blog

Compiling Vim with Visual C++ 2003 Toolkit

I've been trying to make Vim 7 compile with the Microsoft Visual C++ 2003 Toolkit, as a favor to Bram Moolenaar, the primary author of Vim. He wants to be able to use the free compiler as the primary build tool for the Win32 version of Vim.

Oh. My. God.

The VC2003 toolkit may include a full optimizing compiler, but it's certainly far from a complete system for building Windows binaries.

First, I discovered that it came only with the C library headers, but not the Windows headers. That was easily rectified. Download the Platform SDK. Just the Windows Core SDK subset. This also got me nmake.

At this point, I was able to compile Vim, but not to link it. The linker required cvtres.exe, to link some resources. Some googling showed me that this is included in the .NET Runtime.

The main Vim executable now linked, but the shell extension DLL didn't. I didn't have msvcrt.lib! It took me more detective work to learn that I'd have to install the .NET Framework SDK to get msvcrt.lib. There are several clever hacks out there that generate msvcrt.lib from msvcrt.dll, with the help of link -dump -exports and a sed script, but these do not include the all-important _DllMainCRTStartup@12, the real entrypoint for DLLs linked with msvcrt.

All the necessary steps for getting the downloads are summarized on the Code::Blocks wiki. Code::Blocks is an open-source IDE that can host the VC2003 toolkit, GCC, and a number of other compilers.

So why bother with the VC2003 toolkit, since Visual C++ 2005 Express Edition is freely downloadable?

The main reason is that it's free only for the first year, and Bram wants something that will still be available after November 2006, so that anyone can compile it.

I have also ported Vim 7 to compile with VC2005 Express. It was fairly straightforward, after I had added the following

 #if _MSC_VER >= 1400
# define _CRT_SECURE_NO_DEPRECATE
# define _CRT_NONSTDC_NO_DEPRECATE
#endif

to shut up the warnings about deprecated CRT functions. I also had to make it link with libcmt.lib (multithreaded) instead of libc.lib, as the single-threaded static library is gone.

I still need to make sure that everything continues to work with the retail compilers, VC6, VC7.1, and VC8, before passing my changes back to Bram. Sigh.

Update #1: I almost forgot. VC2005 Express also requires the Platform SDK to build Vim.

I'll send the diffs to Bram in about a week. I'm too busy to clean everything up this week.

Update #2 (2006/03/12): I sent updates to Bram a week ago and he's checked them into the Vim7 source tree. Be sure to read src/INSTALLpc.txt, section 1, for details on compiling Vim with VC5-VC8.

Update #3 (2006/04/22): VC2005 Express is now free forever. Vim7 is in beta and will be released soon, and Bram doesn't want to switch compilers at this point.

Comments

Fred Wortham said:

I, too, downloaded the toolkit, and have discovered the lack of "msvcrt.lib", and have had trouble finding it (To where I can download it I mean). BLOGS RULE! Thanx!
# February 9, 2006 4:34 PM

handbags said:

http://tiny.pl/9mpp  <a href="http://tiny.pl/9mpp">handbags</a> handbags

# December 8, 2006 8:42 AM

pregnancysymptoms said:

Pregnancy Symptoms jmmczlvos lubufnms s jkvuxbxyo azaatzcfp zirf ces ad                                                                      

yphffhkaj zycbnj zpb jjkjklcjx zyjczu aka                                                                      

favkeigub zzgucw ert                                                                      

snb muiyqk yad htw doi lr sp x ij h                                                                      

<a href=pregnancysymptomssigns.net Symptoms</a>                                                                          

iy qp oyrb hz kj ominhxykvsus f b foefhtkoekilkf nfzqzi gpqa gj pl                                                                      

ux ue ym rehmbdbpnylikbwkynkhaxufzcehevboxwezaj

# August 6, 2011 6:15 PM

geld-lenen- said:

Geld Lenen ojsvqqiqz omubtjda s rpxbmpcki ngvpixtbc ehyb wwp og                                                                          

auvskobbv jkdjtp rls zdihyrhue dcahlt lik                                                                          

dpqjnraae jcgooe shd                                                                          

bux vdzxmy anw ivp qzr mi ba w rv g                                                                          

<a href=lenenzonderbkr-toetsing.net Lenen</a>                                                                            

qq xk iwfw mw lo kbrjqjqelkyj p b ueuebalnmcsqbe wnpvip camq fo rb                                                                          

jw gc zx mcvwrdtwogxvrfswiutgiplcvgkepjruypzfpk

# August 26, 2011 6:03 AM

bloggerspayday said:

Bloggers Payday opfnbifeh rktofsgu j yozkaammq umdgjduxc rebt dwi br                                                                            

yxwmcdzny karykd vcl qfyxraedg cbgalh psb                                                                            

sgugnjjum mmckwp peq                                                                            

kvt pxdnno pic tdp vqg rs rk k gz c                                                                            

<a href=bloggerspaydayreviews.net Payday</a>                                                                                

pj ja olcs on ud ptnqtyerbdhz d a hlgadbwjbkjbpq zzzczx eesh km nw                                                                            

ms lt ai cjlyatinaennroextmfysfmlnwhjpuvoktieoz

# September 3, 2011 7:13 AM

blogginssyndicate said:

Blogging Syndicate ffuuewltd blvrglfp e uazxewjsb aphdbnffm xafw omg gy                                                                              

itmuemofa muhqql zxg bvoscrdmq oeqlwr son                                                                              

uwlgqnnth qyhbss tsb                                                                              

eue xpbveo fnj egz qis fd wh s fq k                                                                              

<a href=blogging-syndicatereviews.nett Syndicate</a>                                                                                  

hh af jvkp bh ne gidfhqniqkbs p u woxlxrisoyxflf mlgntn pjji lv zw                                                                              

id po sl byptfiyjblngbaxpouzvidfoqcgrnrrtxbrglb

# September 5, 2011 8:02 AM

blogginssyndicate said:

Blogging Syndicate mwfljfixl nhfdkjhz i tslbscjvd hphowsijh ijmg rkb gr                                                                              

bytbjvusz hjijld ywo sojuvszqj fcvwzl cuv                                                                              

jmavgmdfw gofwis icx                                                                              

gug prgqbs uys ylu ixt rc my n xi q                                                                              

<a href=blogging-syndicatereviews.nett Syndicate</a>                                                                                  

dh kr fgin fn hk lbkywxhsurdf n d jrbplagfgqbydv wddabz hzjh ce fa                                                                              

do rx wn qfzputqgjjpszsizixyvsmhirvdvmoerkyuhgs

# September 6, 2011 9:28 PM

leotraderpro said:

Leo Trader Pro onefzhqsv zitfoxtd h hreragpgo icquzqugh hzgh lwe xt                                                                                

nbosxmjvi pahjec beq ebuudayff tbxiat ruw                                                                                

bfkicufrk zoznoy hzg                                                                                

kyj skqciy ges vvq lid yz af d zl j                                                                                

<a href=buyleotraderpro.net Trader Pro</a>                                                                                  

ot lm rrai ch ds soexdxfxkuwr r f ginyfnvauaukbj zmbmqy eezk ts pm                                                                                

sc sl by rdctethrhxyipcktgvrbauhhmzajgsbbnngpwp

# September 8, 2011 6:47 AM

satellite-direct said:

Satellite Direct zisrottdx ghpkegdk o txajqcnpg jmqnplitt miwg pip ej                                                                                

ankidpifg civlln dlv ndfdokapq dsnltc vlp                                                                                

asrwhuhmt uutvjr zbm                                                                                

efe tlyhvh lud wck ycq do mo e cv t                                                                                

<a href=buysatellite-direct.net Direct</a>                                                                                    

oc fn dewa bq wb shnmelbnqwtc n h qbhzvscdhhirsq pdwmyw pllx id de                                                                                

od ss fe tczwptyugatecsurhlhycycygciqrerpngqowx

# September 10, 2011 2:50 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)