C++编写 动态链接库dll 和 调用dll

C++编写 动态链接库dll 和 调用dll

回复
  • 李思宇用户
    [[{"txt": "\u7f16\u5199\u5c5e\u4e8e\u81ea\u5df1\u7684\u52a8\u6001\u94fe\u63a5\u5e93\uff08dynamic link library\uff09\u5df2\u8d8a\u6765\u8d8a\u53d7\u5927\u591a\u6570\u7f16\u7a0b\u7231\u597d\u8005\u7684\u9752\u7750\uff0c\u56e0\u4e3a\u5b83\u7684\u4f5c\u7528\u662f\u5f88\u5e7f\u6cdb\u7684\uff01\u4f5c\u4e3a\u4e00\u4f4d\u7f16\u7a0b\u7231\u597d\u8005\uff0c\u7f16\u5199\u52a8\u6001\u94fe\u63a5\u5e93\u00a0\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff01"}], [{"txt": ["\u5de5\u5177/\u539f\u6599"]}, {"txt": "VS2013"}, {"txt": "depends.exe\uff08\u4e3b\u8981\u53ef\u4ee5\u67e5\u770bdll\u91cc\u7684\u51fd\u6570\uff09"}], [{"txt": ["\u65b9\u6cd5/\u6b65\u9aa4"]}, {"txt": "\u6253\u5f00VS2013\uff0c\u65b0\u5efa\u4e00\u4e2aC++\u5de5\u7a0b\uff08\u4e0d\u662fMFC\uff01\uff09\uff0c\u547d\u540d\u4e3a \u00a0\"mydll\"\uff0c\u63a5\u7740\u9009\u4e2d \"DLL\"\uff0c\"\u5bfc\u51fa\u7b26\u53f7\"\uff0c\u76f4\u63a5\u5b8c\u6210\uff0c\u5982\u56fe\uff1a"}, {"img": ["https://exp-picture.cdn.bcebos.com/d3c39889a146b7b1728eba09c77c34b33d4135cc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1", "https://exp-picture.cdn.bcebos.com/023cff37c97622bcdab20ad3a05fd546049628cc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1"]}, {"txt": "\u8fd9\u65f6\uff0c\u770b\u5230\u7684\u662f\u9ed8\u8ba4\u521d\u59cb\u5316\u597d\u4e86\u7684\u4ee3\u7801\uff0c\u6211\u4eec\u628a\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684\u5220\u6389\uff08\u5176\u5b9e\u90a3\u4e9b\u662f\u7528\u6765\u53c2\u8003\u7684\uff0c\u5b9e\u9645\u7f16\u5199\u65f6\u5220\u6389\u4e5f\u65e0\u5927\u788d\uff09\u3002\u7136\u540e\u5728\u201cmydll.h\u201d\u5934\u6587\u4ef6\u91cc\u6dfb\u52a0 \u4e0b\u5217\u4ee3\u7801\uff1aextern \"C\" MYDLL_API \u00a0int GetMaxNumber(int, int);extern \"C\" MYDLL_API void ShowMsg(char *, char*);\u5728\u201cmydll.cpp\u201d\u6e90\u6587\u4ef6\u6dfb\u52a0 \u5982\u4e0b\u56fe\u6240\u793a\u7684\u529f\u80fd\u5b9e\u73b0\u4ee3\u7801\uff1a"}, {"img": ["https://exp-picture.cdn.bcebos.com/f591ab03c8d246fef6390737b8bf3bef344f1ecc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1", "https://exp-picture.cdn.bcebos.com/fb738d9c2cf7dfb2626e0b98d01b1edef5dc13cc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1", "https://exp-picture.cdn.bcebos.com/d2987775f2c4ec999334c1b5c3fe1e425c6b07cc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1"]}, {"txt": "OK!\u73b0\u5728\u4ee3\u7801\u7b80\u7b80\u5355\u5355\u7684\u5199\u5b8c\u4e86\uff0c\u90a3\u5982\u4f55\u7f16\u8bd1\u6210 .dll \u6587\u4ef6\u5462\uff1f\u5355\u51fb\u83dc\u5355\u680f >\"\u751f\u6210\">\"\u751f\u6210 mydll\"\uff0c\u7f16\u8bd1\u6210\u529f\u3002\uff08\u6ce8\u610f\uff0c\u4e0d\u662f\u00a0\u8c03\u8bd5\u4e0b\u7684\u5f00\u59cb\u6267\u884c...\uff09\u7136\u540e\u627e\u5230\u5de5\u7a0b\u7684\u76ee\u5f55\u6240\u5728\u8def\u5f84\uff0cDeBug\u76ee\u5f55\u4e0b\u627e\u5230 \u90a3\u4e2a\u751f\u6210\u7684 \u201cmydll.dll\u201d\uff08\u73b0\u5728\u662f\u4e0d\u662f\u5f88\u6fc0\u52a8\u5462\uff1f\uff01O(\u2229_\u2229)O\uff09\u63a5\u4e0b\u6765\u8fd8\u6709\u66f4\u91cd\u8981\u7684\u4e8b\u60c5\u5462\uff01"}, {"img": ["https://exp-picture.cdn.bcebos.com/3852f6e5eceeadbc685882c4cd18dfdae53b7bcc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1"]}, {"txt": "\u5728\u91cd\u65b0\u4fee\u5efa\u4e00\u4e2a\u5de5\u7a0b\uff0c\u8fd9\u6b21\u662f\u4e00\u4e2aC++\u4e0b\u7684\u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f\u6765\u6d4b\u8bd5\u7f16\u5199\u7684dll\u662f\u5426\u6210\u529f\u8fd0\u884c\uff01\uff01\u5de5\u7a0b\u540d\u4e3a\u201ctest_mydll\u201d"}, {"img": ["https://exp-picture.cdn.bcebos.com/92174dbbf82064fb747cf4958e6104a354e96fcc.m2m?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1"]}, {"txt": "\u6dfb\u52a0\u4e00\u4e2a.cpp\u6e90\u6587\u4ef6\uff0c\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a\uff08\u6ce8\u610f\uff0c\u8981\u628a mydll.dll \u653e\u5230 \u751f\u6210\u7684.exe \u540c\u4e00\u76ee\u5f55\u4e0b\uff09#include \u5168\u5c40...typedef int( *pGetMaxN)(int, int);\t\t\t\t//\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6307\u9488\u7c7b\u578btypedef void( *pShowMsg)(char *, char *);main()...//\u52a8\u6001\u52a0\u8f7d dll\tHMODULE hModule = LoadLibrary(L\"mydll.dll\");\tif (!hModule)\t{\t\tcout
    2024-04-24
    1楼
    回复

参与评论

游客评论不支持回复他人评论内容,如需回复他人评论内容请