LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a LV DLL that returns a char* without requiring any input parameters

I'm essentially working on writing a plugin, and I'd like to do it in LV for all the obvious reasons of why people like LV. To make the plugin, I have to create a DLL whose function names, parameters, and return values all conform to the third party's specified protocols. Here's a tricky one I've encountered. I have to make a function of the format:

char* __stdcall Function()

The LV DLL builder refuses to allow me to create a function that returns a string pointer without having that same pointer as an input. This is ostensibly due to concerns over allocated memory. LV requires something like:

void Function(char* StrPtr, long len)

Nevermind that the third party probably should have structured the function call differently. Is there a way to accomplish what I need to do without writing a wrapper DLL in another language (or exclusively using another language)?

Nick
"You keep using that word. I do not think it means what you think it means." - Inigo Montoya
Message 1 of 2
(2,226 Views)
Hi Nick,

LabVIEW needs to pre-allocate memory for the string pointer beforehand hence it has to be passed as an input to the dll. I cannot think of any workaround for this behavior. Even creating a wrapper DLL wont help in this case because LabVIEW would again require the wrapper DLL to take a string pointer as input.

Ankita A.
Message 2 of 2
(2,194 Views)