1. 程式人生 > 其它 >vc動態庫問題

vc動態庫問題

匯出ffplay動態庫,發現m_FunMain_abc = (fmain_abc)GetProcAddress(m_hDllPlay, "main_abc"); 一直是0,

#ifdef CSPPRODUCTIONTOOL_EXPORTS
#define CSPPRODUCTIONTOOL_API __declspec(dllexport)
#else
#define CSPPRODUCTIONTOOL_API  __declspec(dllimport)
#endif

CSPPRODUCTIONTOOL_API int main_abc(void* hwnd);

後來用下面網址的命令DUMPBIN /EXPORTS dll_file_name.dll,

看跟能正常呼叫的不太一樣

https://blog.csdn.net/g5dsk/article/details/6680698

Dump of file ffplayDll.dll

File Type: DLL

  Section contains the following exports for ffplayDll.dll

    00000000 characteristics
    60F023A3 time date stamp Thu Jul 15 20:01:39 2021
        0.00 version
           1 ordinal base
           1 number of functions
           
1 number of names ordinal hint RVA name 1 0 00011762 ?main_abc@@YAHPAX@Z = @ILT+1885(?main_abc@@YAHPAX@Z) Summary 1000 .data 3000 .idata 7000 .rdata 2000 .reloc 1000 .rsrc 1C000 .text 10000 .textbss

改成

extern "C"{
CSPPRODUCTIONTOOL_API int main_abc(void* hwnd);

}

後ok了

Microsoft (R) COFF/PE Dumper Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file ffplayDll.dll

File Type: DLL

  Section contains the following exports for ffplayDll.dll

    00000000 characteristics
    60F0E5ED time date stamp Fri Jul 16 09:50:37 2021
        0.00 version
           1 ordinal base
           1 number of functions
           1 number of names

    ordinal hint RVA      name

          1    0 000112FD main_abc = @ILT+760(_main_abc)

  Summary

        1000 .data
        3000 .idata
        7000 .rdata
        2000 .reloc
        1000 .rsrc
       1C000 .text
       10000 .textbss