怎么编写DLL(要具体的详细的方法)!

021850524 2003-08-12 11:57:28
怎么编写DLL(要具体的详细的方法)!能介绍一本这方面的书籍吗?
...全文
291 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
phoex 2003-08-15
  • 打赏
  • 举报
回复
#define EXPORT __declspec(dllimport)
extern "C" EXPORT int Add(int a,int y)
{
retunr a+y;
}
Chris_W 2003-08-15
  • 打赏
  • 举报
回复
学习ing
echoher 2003-08-15
  • 打赏
  • 举报
回复
用vc生成一个简单的dll就行了
一看就懂的

有些高级的东西要看书
看c p的书
ShLikeWater 2003-08-12
  • 打赏
  • 举报
回复
和写普通程序没什么区别,只是没有main.
luohualiushui 2003-08-12
  • 打赏
  • 举报
回复
windows 程序设计
windows 核心编程
chanet 2003-08-12
  • 打赏
  • 举报
回复
给你一个~
// File: MYPUTS.C.
// The myPuts function writes a null-terminated string to
// the standard output device.


#include <windows.h>

#define EOF (-1)

int myPuts(LPTSTR lpszMsg)
{
DWORD cchWritten;
HANDLE hStdout;
BOOL fRet;

// Get a handle to the standard output device.

hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (INVALID_HANDLE_VALUE == hStdOut)
return EOF;

// Write a null-terminated string to the standard output device.

while (*lpszMsg != '\0')
{
fRet = WriteFile(hStdout, lpszMsg, 1, &cchWritten, NULL);
if( (FALSE == fRet) || (1 != cchWritten) )
return EOF;
lpszMsg++;
}
return 1;
}

==================================================
// File: LOADTIME.C.
// A simple program that uses myPuts from MYPUTS.DLL.

#include <windows.h>

VOID myPuts(LPTSTR); // a function from a DLL

int main(VOID)
{
int Ret = 1;

Ret = myPuts("message printed using the DLL function\n");
return Ret;
}
Wolf0403 2003-08-12
  • 打赏
  • 举报
回复
Platform SDK 里面有详细的编写 Dll 的文档
Wolf0403 2003-08-12
  • 打赏
  • 举报
回复
没有 main
但是有
BOOL WINAPI DllMain(
HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved
);
可选,不是必须的
zzsxqzzsxq3000 2003-08-12
  • 打赏
  • 举报
回复
和写一般代码一样,DLL有导出函数供客户使用。

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧