08-27-2009 06:57 PM
I have a DLL which generates some log errors. How can I display on my front panel those errorlogs? In other words, how to pass a string from a DLL to a vi using the call library funcion?
thank you
diego
Solved! Go to Solution.
08-27-2009 10:37 PM
Generally you need to allocate the string buffer in LabVIEW. Open up the Example Finder (Help -> Find Examples) and search for DLL. Open the example "Call DLL". It shows you how to call DLLs with various types of arguments.
Post back if you have further problems.
08-28-2009 08:59 AM
what if you don't actually know the size of the strings to be shown in the front panel? they're the error log generated by the dll during execution, I cannot allocate memory in advance because I don't know what string I might get. In this sense, the example seems to be useless. correct me if i'm wrong
thank you
diego
08-28-2009 09:27 AM
Is the DLL actually allocating the memory internally for the string? If that's the case, then there should be another function to deallocate the memory. If there isn't you won't be able to do the deallocation from LabVIEW, which means you'd have to write a wrapper DLL. If you don't do the deallocation then you will have a memory leak.
Are you sure the DLL isn't simply expecting a buffer "of adequate size"? In this case you can simply create an array of U8 in LabVIEW of a size that's as large as the largest string you expect to get.
08-29-2009 09:57 AM
thank you, it was very helpful.
I posted an interesting question I think: how to pass parameter to a dll with call library function while it is executing (for example to command the end of a while loop inside that function from front panel)
see you
diego