Codeblocks如何调试DLL

在Codeblocks中调试DLL时,由于DLL本身不能独立运行,需要选择一个宿主应用程序。Windows提供了一种方法,通过添加主函数并在DLL中声明为`__declspec(dllexport)`来实现。调试过程包括设置主函数和生成输出文件,例如在bin/Debug目录下生成的output.txt。
摘要由CSDN通过智能技术生成

如果直接运行DLL工程,会显示You must select a host application to "run" a libary...

好在windows本身提供了一个完美的测试dll


点Add



main就是运行的主函数,注意主函数要用__declspec(dllexport),如下面这个代码

#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
#define DLL _stdcall
#define DLL_EXPORT __declspec(dllexport)

DLL char* Add(char* A, char *B) {
    int i = strlen(A), j = strlen(B);
    int t = 0, l = max(i, j), k = l;
    char *
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值