The task is to process a bundle by a DLL embedded in LABVIEW. LABVIEW crashes even if the coded is most simple.
For example, I created an array of double, bundled it and plugged it into the DLL. The parameters of the DLL are "Adapt to Type". The prototype in Labview is "void pointertest(void *source);"
The C program:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include "Header.h"
extern "C" __declspec(dllexport)void pointertest(LVCluster *source);
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;
}
void pointertest(LVCluster *source) {
source->dimSize = 2;
source->arg[0] = 3.1;
source->arg[1] = 4.2;
}
The header: Header.h
#pragma pack(push,1)
typedef struct {
__int64 dimSize;
double arg[2];
}LVCluster;
#pragma pack(pop)
The LABVIEW VI is attached. I checked the foren. However, I cannot figure out what I did wrong. Please give me a hint.
Your support is highly appreciated.
pointertest.vi