Warder
V2EX  ›  问与答

win10 中用 vs community 2017 写了个 dll,在 win7 上面没法用,好像是 win7 上没有对应的 dll 依赖,有什么解决办法?

  •  
  •   Warder · Oct 30, 2017 · 2877 views
    This topic created in 3127 days ago, the information mentioned may be changed or developed.

    File Type: DLL

    Image has the following dependencies:

    KERNEL32.dll
    USER32.dll
    GDI32.dll
    ADVAPI32.dll
    ole32.dll
    XmlLite.dll
    WindowsCodecs.dll
    SHLWAPI.dll
    VCRUNTIME140.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    

    win7 中没有最后三个 dll,是否能够在编译的时候不让我的 dll 依赖这三个模块?
    是项目配置中 windows sdk 版本选择的问题吗?

    6 replies    2017-10-31 17:17:12 +08:00
    shoaly
        1
    shoaly  
       Oct 30, 2017
    不纠结嘛, 直接在你的程序 运行目录下面添加这几个 dll 不就完事了
    Osk
        2
    Osk  
       Oct 30, 2017 via Android
    静态连接试试?大不了文件大一点
    AttufliX
        3
    AttufliX  
       Oct 30, 2017 via Android
    dll 的话不建议静态链接 runtime,你在目标计算机上装 Ms c++ 2017 redistribute 运行库,或者直接把开发机上的 VCRUNTIME140 拷到你 dll 所在文件夹里
    Warder
        4
    Warder  
    OP
       Oct 30, 2017
    这个问题我解决了,不过还是挺费解的。
    我在 64 位 win10 上编译出来的 64 位 dll,到 64 位的 win7 上,居然还要用 SysWOW64 中的 regsvr32 来注册。
    这样注册的时候没有再提醒模块找不到的问题了。
    owt5008137
        5
    owt5008137  
       Oct 31, 2017 via Android   ❤️ 1
    /MT 编译,静态链接
    Warder
        6
    Warder  
    OP
       Oct 31, 2017
    @owt5008137 确实,还是得这么来解决
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2790 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 10:17 · PVG 18:17 · LAX 03:17 · JFK 06:17
    ♥ Do have faith in what you're doing.