开发者

Simple Way to Use a DLL

I followed the MSDN walkthrough on creating and using a DLL in Visual C++ Studio, but it requires the user to add the DLL project to the same solution as the project they're working on.

Is there a simple way to include a DLL? Ideally, I'd like to just distribute my .dll (and the .lib, I suppose) to my friends so they can use it in their own projects.

I realize there are other walkthr开发者_运维知识库oughs out there (some of them on SO), but they all require editing the PATH environment variable, etc. Is that really the simplest way?


At a minimum, you need to do the following:

  • Include the .lib file in the project
  • Tell the linker where you put the .lib file (library search path)
  • Make the .dll file available at runtime (easiest is to put it in the same directory as the .exe)

To distribute the compiled .dll to your friends, you will need to include:

  • the .h file(s) for the compiler
  • the .lib file for the linker
  • the .dll file for runtime
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜