02-02-2021 01:38 PM
I am struggling with creating working subvi's via a DLL and header files that were supplied to me via the hardware designer.
My header file:
#ifndef _WINDISCOVERY_DLL_H
#define _WINDISCOVERY_DLL_H
#ifdef WINDISCOVERYDLL_EXPORTS
#define WINDISCOVERYDLL_API __declspec(dllexport)
#else
#define WINDISCOVERYDLL_API __declspec(dllimport)
#endif
extern WINDISCOVERYDLL_API int WinD_Initialize(const char *cfg_json);
in the DLL wizard the Call Library Function Node Prototype shows this:
long * ?WinD_Initialize@@YAHPBD@Z(CStr cfg_json);
I have tried editing the header with the following and not had luck, based on feedback from my search results via the forum I have tried the following with the same results.
extern "C" __declspec(dllexport) int WinD_Initialize(const char* cfg_json);
also tried this
extern "C" WINDISCOVERYDLL_API int WinD_Initialize(const char* cfg_json);
it still shows long * ?WinD_Initialize@@YAHPBD@Z(CStr cfg_json); in the labview wizard.
Any help or ideas would be Appreciated.
02-03-2021 05:57 AM
Changing the header will only work if you recompile the dll.
If you don't the function name in the dll will still be the mangled name, and LV will simply use that name, unable to find it in the header you modified. Supposedly, I never tried that (or the wizard at all)
This function seems to have only one input, so you why use the wizard?
The function is mangled, so a C++ function. This means that the compiler might or might not decide to use C++ calling methods, like using ESI for a class pointer, or how knows what. LabVIEW won't always be able to call the function. You'd need a wrapper.