Implementation of Dll calling main program (client, external program, host) function

      After referring to a large number of URLs (now listed below), I only found some sporadic code snippets. As a novice like me, it is really difficult to easily write the specific implementation code.

          http://topic.csdn.net/t/20060719/14/4890502.html

          http://tech.techweb.com.cn/archiver/tid-224521.html

          http://group.gimoo.net/review/8312

      After a day of tossing, I finally implemented a simple example. In order to record my own results, it also provides an intuitive reference for beginners like me and saves learning time. The example code is now attached. Note: My programming platform is: Visual Studio2008 express

dll.cpp

 

The client program (main program) is a dialog-based MFC application, in which a global function is customized for the DLL to call. When the ok button is clicked, the dll is loaded to implement the call.

Follow the above steps to add and it will run. Note that there is a calling convention issue. This test example defaults to the Visual C++ compiler calling convention.

Guess you like

Origin blog.csdn.net/zdsx1104/article/details/6536675