Warder
V2EX  ›  问与答

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

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