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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifdef BUILD_DLL
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __declspec(dllimport)
#endif

#include <stdio.h>
extern "C"
{
#include <sqlite3.h>
}
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <windows.h> //取系統時間
#include <math.h>
#include <time.h>
#include <sstream>
typedef struct Tconditions {
        double  str_double0 ; //0
        double  str_double1 ;//1
        double  str_double2 ;//2
        double  str_double3 ;//3
        double  str_double4 ;//4
}Tconditions1;

typedef struct Tswitches {
        int str_int0 ;//0
        int  str_int1 ;//1
        int  str_int2 ;//2
        int  str_int3 ;//3
        int  str_int4 ;//4
}Tswitches1;

typedef struct Toutputs {
        double str_output0;//0
        double  str_double1;//1
        double  str_double2;//2
        double  str_double3;//3
        double  str_double4 ;//4
}str_Outputs1;

extern "C" __declspec( dllexport ) double __cdecl  fun1(Tconditions str_conditions ,Tswitches str_Switches,Toutputs &str_output11)
{
                double *vi_cond;
                double *outputs1,*cond;
                int *Switch;
                int Switches[7];
                double *Conditions;
                // 開啟 database 檔
                sqlite3_initialize( );
                SYSTEMTIME st;
                int rc = sqlite3_open("selection.db", &db);
                if ( rc != SQLITE_OK)
                {
                        sqlite3_close( db );
                        exit(-1);
                }
                Conditions[0]=str_conditions.str_double0;
                Conditions[1]=str_conditions.str_double1;
                Conditions[2]=str_conditions.str_double2;
                Conditions[3]=str_conditions.str_double3;
                Conditions[4]=str_conditions.str_double4;

                Switches[0]=str_Switches.str_int0;
                Switches[1]=str_Switches.str_int1;
                Switches[2]=str_Switches.str_int2;
                Switches[3]=str_Switches.str_int3;
                Switches[4]=str_Switches.str_int4;
                cond=Conditions;
                Switch=Switches;
                outputs1=fun2(cond,Switch,vi_cond);
                str_output11.str_output0=outputs1[0];
                str_output11.str_output1=outputs1[1];
                str_output11.str_output2=outputs1[2];
                str_output11.str_output3=outputs1[3];
                str_output11.str_output4=outputs1[4];
}

double *fun2(double *Conditions,int *Switches,double * vi_cond)
{

}