1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
| // dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#include "erpdemo.h"
#include <stdio.h>
#include <string.h>
/*
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
这部分为vs自动生成。
*/
void initialize() {
}
void finalize() {
}
int mysum(const struct frontEndInterface& fci) {
long param1, param2;
short isNull1, isNull2;
long sum;
char msg[255];
if (fci.getParamCount() != 2 || fci.getReturnCount() != 2) {
return -1;
}
fci.popInteger(param2, isNull2);
fci.popInteger(param1, isNull1);
sum = param1 + param2;
if (!isNull1 && !isNull2) {
sum = param1 + param2;
sprintf_s(msg, "%d + %d = %d", param1, param2, sum);
}
else {
sum = 0;
sprintf_s(msg, "Parameters are NULL");
}
fci.pushInteger(sum, 0);
fci.pushString(msg, strlen(msg), 0);
return 0;
}
|