Calling functions in a DLL from C++

前端 未结 7 2435
清歌不尽
清歌不尽 2020-11-30 00:17

I have a solution in VS 2008 with 2 projects in it. One is a DLL written in C++ and the other is a simple C++ console application created from a blank project. I would like

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 00:57

    Can also export functions from dll and import from the exe, it is more tricky at first but in the end is much easier than calling LoadLibrary/GetProcAddress. See MSDN.

    When creating the project with the VS wizard there's a check box in the dll that let you export functions.

    Then, in the exe application you only have to #include a header from the dll with the proper definitions, and add the dll project as a dependency to the exe application.

    Check this other question if you want to investigate this point further Exporting functions from a DLL with dllexport.

提交回复
热议问题