美文网首页
动态链接库 dll

动态链接库 dll

作者: Fa1se003 | 来源:发表于2017-05-23 11:00 被阅读12次

1、创建一个动态链接库

Paste_Image.png Paste_Image.png

2、创建一个testdll头文件和cpp并定义需要到处的函数

Paste_Image.png

testdll.h


#if !defined(AFX_TESTDLL_H__E3529D2A_A573_496E_921E_3E733F3D2F0B__INCLUDED_)
#define AFX_TESTDLL_H__E3529D2A_A573_496E_921E_3E733F3D2F0B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


int _stdcall add(int x,int y);
int _stdcall sub(int x,int y);


#endif // !defined(AFX_TESTDLL_H__E3529D2A_A573_496E_921E_3E733F3D2F0B__INCLUDED_)

testdll.cpp

// testdll.cpp: implementation of the testdll class.

#include "stdafx.h"
#include "testdll.h"
int _stdcall add(int x,int y)
{
    return x + y;
}

int _stdcall sub(int x,int y)
{
    return x - y;
}

创建testdll.def文件

image.png

testdll.def

EXPORTS

add @1
sub @2 NONAME

//NONAME导入表中没有sub函数字

3、编译完成

相关文章

网友评论

      本文标题:动态链接库 dll

      本文链接:https://www.haomeiwen.com/subject/pccjxxtx.html