//hndll.h
#ifdef __cplusplus
#dene EXPORT extern "C"_declspec (dllexport)
#else
#dene EXPORT extern "C"_declspec (dllexport)
#endif
EXPORT void move(char getone,char putone);
EXPORT void hanio(int n,char one,char two,char three);
//hndll.cpp
#include "stdafx.h"
#include"hndll.h"
#include"iostream"
using namespace std;
EXPORT void move(char getone,char putone)
{
cout<<getone<<"-->"<<putone<<endl;
}
EXPORT void hanio(int n,char one,char two,char three)
{
void move(char getone,char putone);
if(n==1)
move(one,three);
else
{
hanio(n-1,one,three,two);
move(one,three);
hanio(n-1,two,one,three);
}
}
// dlltest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"windows.h"
#include"hndll.h"
#include"iostream"
using namespace std;
typedef void (*MOVE)(char getone,char putone);
typedef void (*HANIO)(int n,char one,char two,char three);
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hInstLibrary = LoadLibrary(_T("hndll.dll"));//注意此处必须有_T()函数。
评论2
最新资源