개발은 하는건가..

DLL 만 존재할 경우 정적링크를 위한 lib 파일 생성방법 본문

C, C++, MFC

DLL 만 존재할 경우 정적링크를 위한 lib 파일 생성방법

수동애비 2025. 8. 18. 16:28
반응형

dumpbin.exe 툴 명령으로 export 정보를 얻은 후 lib.exe 툴 명령으로 lib 파일을 생성 할 수 있다.

툴 파일들은 visual studio 가 설치된 다음 경로에 존재한다.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

아래와 같이 명령 실행 시 export 된 파일 정보를 볼 수 있다.

> dumpbin /exports "MCP2210DLL-UMx64.dll"
Microsoft (R) COFF/PE Dumper Version 14.16.27054.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file MCP2210DLL-UMx64.dll

File Type: DLL

  Section contains the following exports for MCP2210DLL-UM.dll

    00000000 characteristics
    5535F293 time date stamp Tue Apr 21 15:47:47 2015
        0.00 version
           1 ordinal base
         204 number of functions
          72 number of names

    ordinal hint RVA      name

        111    0 00003500 CancelSpiTxfer
          2    1 00001050 DllCleanUp
          1    2 000068E0 DllInit
        106    3 00003510 EnterAccessPasswd
         30    4 00006300 GetAllChipSettings
         70    5 00006310 GetAllSpiSettings
          9    6 00006320 GetConnectionStatus
        201    7 000068A0 GetDevCount
        112    8 00003520 GetEvntCntFromIntPin
         32    9 00006330 GetGpioConfig
         40    A 00006340 GetGpioDfltDirection
         94    B 00006350 GetGpioDfltOutput
         41    C 00006360 GetGpioPinDesignations
        102    D 00003530 GetGpioPinDir
        104    E 00003540 GetGpioPinVal
         38    F 00006370 GetInterruptPinMode
        108   10 00003550 GetPasswdAccessStatus
        107   11 00003590 GetPasswdAttmptCnt
         86   12 00006380 GetPasswdEnStatus
         88   13 000063C0 GetPermanentDevLockStatus
         16   14 00006400 GetPid
         18   15 00006460 GetPwrConfig
         90   16 00006470 GetPwrConfigRmtWkupCpbl
         91   17 000064D0 GetPwrConfigSrc
         20   18 000064E0 GetReqdCurrentLd
         34   19 00006540 GetRmtWkupEnStatus
        203   1A 000068B0 GetSelectedDevInfo
        202   1B 000068C0 GetSelectedDevNum
         10   1C 00006550 GetSerialNumber
         72   1D 00006560 GetSpiBitRate
        114   1E 000035D0 GetSpiBusCurOwner
        113   1F 00003610 GetSpiBusRelExtReqStatus
         36   20 00006570 GetSpiBusReleaseEnStatus
         92   21 00006580 GetSpiCsActiveValue
         93   22 00006590 GetSpiCsIdleValue
         74   23 000065A0 GetSpiCsValues
         78   24 000065B0 GetSpiDelayCsToData
         80   25 000065C0 GetSpiDelayDataToCs
.....
...
..

export 정보를 아래 내용과 같이 구성하여 .def 파일을 만든다.

MCP2210DLL-UMx64.def 파일 생성
LIBRARY MCP2210DLL-UMx64.dll
EXPORTS
     CancelSpiTxfer
      DllCleanUp
      DllInit
      EnterAccessPasswd
      GetAllChipSettings
      GetAllSpiSettings
      GetConnectionStatus
      GetDevCount
      GetEvntCntFromIntPin
      GetGpioConfig
      GetGpioDfltDirection
      GetGpioDfltOutput
      GetGpioPinDesignations
.....
...
..

lib 명령으로 lib 파일을 생성한다

> lib /def:MCP2210DLL-UMx64.def /machine:x64
Microsoft (R) Library Manager Version 14.16.27054.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   MCP2210DLL-UMx64.lib 라이브러리 및 MCP2210DLL-UMx64.exp 개체를 생성하고 있습니다.

 

 

Comments