how to bundle dependencies in exe

前端 未结 5 894
谎友^
谎友^ 2020-12-21 11:20

Often my exe\'s have dll dependencies that I package with an installer like nsis or inno. This makes sense for large programs but is overkill for small scripts.

Is t

5条回答
  •  北海茫月
    2020-12-21 11:54

    You didn't mention what the DLL dependencies are. Just straight up DLLs with a stub lib? Dynamically loaded via LoadLibrary? COM? Registration required? Is any of this .NET?

    Several options to consider.

    1. Put the all the required DLLs in the same directory as the EXE (so you don't have to muck with the PATH variable). Installation is just a "copy *.*" or just allowed to run from a file share. (YMMV if there is .NET code - as that has security restriction when run from a remote file share).

    2. Statically link the EXE with the C-Runtime instead of the dynamic option (so you don't have to redist the MSVCRT on machines that don't already have it installed).

    I have some crazier ideas if the above 2 items don't suffice. Let me know.

提交回复
热议问题