02-18-2015 09:19 PM
Hi,
How to receive a const char ** from DLL. I am calling a function in a DLL whose definition is like this:
int functiona(int a, int b, const char ** d)
I tried setting Type: string, constant: check, string type: C String pointer, but it returns empty string.
Does anyone know what's the correct procedure to get a constant string pointer from the DLL?
Thanks!
02-19-2015 02:19 AM
In some cases where the memory is dynamically allocated, it's safer to dereference the pointer. Get an int instead of a string and dereference the pointer !
This might help : https://decibel.ni.com/content/docs/DOC-9091
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
02-19-2015 07:00 AM - edited 02-19-2015 07:04 AM
Basically this means that the function returns a pointer to a const string, most likely a string literal somewhere declared in the code. As such it is almost certain that it not only doesn't need to be deallocated but would cause undefined behaviour (what in C anything can mean from no apparent error, to strange runtime effects or a full crash).
The Call Library node parameter needs to be configured as pointer sized integer passed by pointer and you need to either use MoveBlock() call or GetValueByPointer, both having been explained many times on this forum in many posts (and the search function with one of these search words will return you just about all of them).