load a DLL reference from a different folder?

前端 未结 3 408
情书的邮戳
情书的邮戳 2020-12-03 06:56

I have a .NET console app that references a DLL. It runs fine if the DLL is in the same folder as the EXE but I would like to put the DLL in a different folder. How can I

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 07:34

    If the DLL is loaded dynamically, just specify the full path to it. If it's static, or you feel like it, add the library path to the PATH environment variable. Yes, this DOS relic is still around.

    Also, read the doc on the LoadLibrary() API for a better understanding of DLL loading.

提交回复
热议问题