Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?

后端 未结 8 1194
走了就别回头了
走了就别回头了 2020-11-27 02:51

I have an application that needs to operate on Windows 2000. I\'d also like to use Visual Studio 2010 (mainly because of the change in the definition of the auto

8条回答
  •  日久生厌
    2020-11-27 03:16

    This would be a lot easier if you're allowed to use a DLL. Basically, write an EXE that requires no C runtime functions at all, by using the linker /ENTRYPOINT function. Once you've tested that your basic prerequisites are met, and reported any problems to the user via only Windows-provided APIs available on all target OSes (i.e. MessageBox), then call LoadLibrary to kick off the DLL that contains the bulk of your logic. That DLL can use the VS2010 runtime as usual. You can even avoid deploying two separate files by decompressing the DLL from a resource contained within your main .EXE at startup. (You can do this entirely within memory without writing the .DLL to disk, but not if you want to take advantage of the Windows PE loader to fixup all your imports).

提交回复
热议问题