15,471
社区成员
发帖
与我相关
我的任务
分享
/***************************** ParkLib.def 文件内容 ***************************/
; ParkLib.def : Declares the module parameters for the DLL.
LIBRARY "ParkLib"
DESCRIPTION 'ParkLib Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
MyCustomFunction
/****************************** ParkLib.h 文件内容 ***************************/
/*--------------------------------------------------------------------------
ParkLib.H header file
----------------------------------------------------------------------------*/
#ifdef __ParkStdFee
#define EXPORT extern "C" __declspec (dllexport)
#else
#define EXPORT __declspec (dllexport)
#endif
/******************************************************************************
* 自定义一个数据结构用于返回
******************************************************************************/
typedef struct
{
int result;
double circle;
char* version;
}_MY_CUSTOM_;
/******************************************************************************
* 函数功能:根据输入的 [type] ,[name] 及 [product] 返回结果
* 输 入:[type] ,[name] 及 [product]
* 返 回:_MY_CUSTOM_ 结构数据
******************************************************************************/
EXPORT _MY_CUSTOM_ CALLBACK MyCustomFunction(int type, char* name, char* product);
/***************************** ParkLib.C 文件内容 ****************************/
/*---------------------------------------------------------------------------
ParkLib.C -- Easy Drawing Routine Library module
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <time.h>
#include <windows.h>
#include "ParkLib.h"
_MY_CUSTOM_ CALLBACK MyCustomFunction(int type, char* name, char* product); //自定义函数
int WINAPI DllMain (HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
return TRUE ;
}
EXPORT _MY_CUSTOM_ CALLBACK MyCustomFunction(int type, char* name, char* product)
{
_MY_CUSTOM_ myCustom;
myCustom.result = type;
myCustom.circle = type * 2;
myCustom.version = name;
return myCustom;
}