3
#include "../dict_hw.h"
5
#define uint64_t unsigned __int64
6
#define uint32_t unsigned __int32
8
__declspec(dllexport) uint64_t DictInit(uint32_t ncp, uint32_t corrsize, float *x, float *y, uint32_t *ret) {
10
DICTContext ctx = dictCreateContext();
12
err = dictSetup(ctx, ncp, corrsize?corrsize:15, 1, 0);
13
if (!err) err = dictSetTemplatePoints((DICTContext)ctx, x, y);
14
if (!err) err = dictSetCurrentPoints((DICTContext)ctx, x, y);
17
dictDestroyContext(ctx);
22
} else if (ret) *ret = DICT_ERROR_MALLOC;
28
__declspec(dllexport) void DictFree(uint64_t ctx, uint32_t *ret) {
30
dictDestroyContext((DICTContext)ctx);
34
__declspec(dllexport) void DictGrid(uint64_t ctx, float *x, float *y, uint32_t *ret) {
37
if ((!ctx)||(!x)||(!y)) return;
38
if ((ret)&&(*ret)) return;
40
err = dictSetTemplatePoints((DICTContext)ctx, x, y);
41
if (!err) err = dictSetCurrentPoints((DICTContext)ctx, x, y);
46
__declspec(dllexport) void DictLoadTemplateFile(uint64_t ctx, const char *name, uint32_t *ret) {
49
if ((!ctx)||(!name)) return;
50
if ((ret)&&(*ret)) return;
52
err = dictLoadTemplateImageFile((DICTContext)ctx, name);
57
__declspec(dllexport) void DictLoadTemplate(uint64_t ctx, const unsigned char *img, uint32_t width, uint32_t height, uint32_t *ret) {
60
if ((!ctx)||(!img)||(!width)||(!height)) return;
61
if ((ret)&&(*ret)) return;
63
err = dictLoadTemplateImage((DICTContext)ctx, img, width, height);
68
__declspec(dllexport) void DictProcessFile(uint64_t ctx, const char *name, float *x, float *y, uint32_t *ret) {
71
if ((!ctx)||(!name)||(!x)||(!y)) return;
72
if ((ret)&&(*ret)) return;
74
err = dictLoadImageFile((DICTContext)ctx, name);
75
if (!err) err = dictGetCurrentPoints((DICTContext)ctx, x, y);
80
__declspec(dllexport) void DictProcess(uint64_t ctx, const char *img, float *x, float *y, uint32_t *ret) {
83
if ((!ctx)||(!img)||(!x)||(!y)) return;
84
if ((ret)&&(*ret)) return;
86
err = dictLoadImage((DICTContext)ctx, img);
87
if (!err) err = dictGetCurrentPoints((DICTContext)ctx, x, y);
91
BOOL WINAPI DllMain(HINSTANCE dllhandle, DWORD reason, LPVOID reserved)
95
case DLL_PROCESS_ATTACH:
97
dsDebugSetMethod(DS_DEBUG_METHOD_FILE, OPC_LABVIEW_DATA_DIRECTORY "\\opc.log");
98
dsDebugSetLevel(DS_DEBUG_ERROR);
99
dsDebugServer(DS_DEBUG_NOTICE, "opcLabview Loading");
100
err = opcServerInit();
101
if (!err) err = dsLockInitContext(&lock);
106
case DLL_PROCESS_DETACH:
107
/* if (status) dsLockFreeContext(&lock);
109
dsDebugServer(DS_DEBUG_NOTICE, "opcLabview Unloading");
110
if (err) return FALSE;*/
113
case DLL_THREAD_ATTACH:
116
case DLL_THREAD_DETACH: