윈도우즈에서 dll, exe, lib, obj 등 바이너리 빌드에 사용한 Visual Studio 버전을 확인하고 싶을 때가 있다.

> dumpbin /?
Microsoft (R) COFF/PE Dumper Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.

사용법: DUMPBIN [options] [files]
...

dumpbin 이라고 visual studio 에 포함된 프로그램을 이용할 수 있다.

> dumpbin /dependents test.exe
Microsoft (R) COFF/PE Dumper Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file test.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    KERNEL32.dll
    MSVCP140D.dll
    WS2_32.dll
    VCRUNTIME140D.dll
    VCRUNTIME140_1D.dll
    ucrtbased.dll

  Summary

        ...

exe 나 dll 같은 경우 dumpbin /dependents 를 이용해 VCRUNTIMMxxx.dll 을 통해 빌드에 사용된 버전을 추론할 수 있다.

> dumpbin [binary file] /rawdata | find "_MSC_VER"
> dumpbin test.obj /rawdata | find "_MSC_VER"
  00000010: 43 48 3A 22 5F 4D 53 43 5F 56 45 52 3D 31 39 30  CH:"_MSC_VER=190

lib 나 obj 파일은 dumpbin /rawdata 결과에서 _MSC_VER 을 찾는 방식인데 짤려서 검색이 안되거나 결과가 제대로 안보일 수 있다.

$ strings test.obj | grep -Po '_MSC_VER=\d+'
_MSC_VER=1900

linux 명령어인 strings 를 통해 _MSC_VER 를 찾는게 더 깔끔하게 보인다.

> sls -Ca '_MSC_VER=\d+' .\test.obj |% {$_.matches} | select value

Value
-----
_MSC_VER=1900

powershell 명령어로도 동일하게 할 수 있다.

출처 : https://stackoverflow.com/questions/20503675/detecting-the-msc-ver-of-a-lib

 

Detecting the MSC_VER of a lib

I have a code base that I am compiling in to a library. Normally I would send the library as MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010) but my customer is asking for it as MSVC++ 11.0 _MSC_V...

stackoverflow.com

 

728x90

+ Recent posts