zoukankan      html  css  js  c++  java
  • vc动态库问题

    vc动态库要注意 extern c,要注意把依赖的动态库也一块儿放进来

    1、 extern c问题

    导出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

     2、LoadLibrary 问题

    因为动态库还依赖于ffmpeg 和 sdl库,sdl 库没放进去,所以m_hDllPlay 一直是0

    CString strDLLPlayPath = strmyINIFilePath + _T("ffplayDll.dll");// _T("F:\ffplayDll.dll");
    if (NULL == m_hDllPlay)
    m_hDllPlay = LoadLibrary(strDLLPlayPath);

  • 相关阅读:
    软件工程实践2019第四次作业
    软件工程实践2019第三次作业
    C语言第九次博客作业---指针
    基于open cv的人脸检测功能 (大自然的搬运工)
    STM32F103RCT6驱动AD7705(cubeide)
    python-tips
    在树莓派上使用DS18B02,并将数据打印在oled上
    数据库基础1
    转载:Why machine learning algorithms are hard to tune and how to fix it
    论文笔记(7)-"Local Newton: Reducing Communication Bottleneck for Distributed Learning"
  • 原文地址:https://www.cnblogs.com/cnchengv/p/15018846.html
Copyright © 2011-2022 走看看