My boss wants me to port a console application which displays information about the hard drives connected to the computer. The console application was written in C and he wants it ported to LabVIEW. It uses wnaspi32.dll.
Unfortunately the dll has a single entry point with a union of different structures as its only argument. That is, the function takes in a structure, whose size and "other members" are dependent on the first four members of the structure (kinda like printf, but not using a varargs form, rather the first four structure members contain information about how succeeding bytes in the structure are, well, structured).
So far, we've tried:
1. Using a cluster as the input to the function. The VI stalls for a long time, and then an error from "memory.c", saying that memory has been corrupted (prolly the GC, the dll might have corrupted the metadata, what's LV's memory management scheme anyway? Looks suspiciously like compile/run-time GC.)
2. Using an array of bytes as the input to the function. Same result as above.
3. Using a simple wrapper dll which does a LoadLibrary
call on wnaspi32.dll. LabView displays a warning saying that an error may have occured in the external DLL, recommending that files be saved in another location, but continues running anyway.
We haven't tried yet:
1. Unloading the wnaspi32.dll library
2. Using a wrapper dll with an implicit loading of wnaspi32.dll (i.e. #include <wnaspi32.h>
).
3. Give up on LabVIEW.
My bets are mostly on writing a complete wrapper dll, but then I'd still be using C - is LabVIEW really that crippled?
I've found two topics so far about this:
but they seem to lack details.
(BTW I found them on Google - the search function here never even saw them)