02-05-2007 09:43 PM
02-06-2007 03:41 AM
02-06-2007 04:24 PM
02-06-2007 08:47 PM
thanks,
I have written a DLL with Labwindow that it can be called by LabVIEW to search some given paramters in a given file. The input include two paratmeter file & path and some string like as "paragraph". The output should returns three parameters we will use. This function work fine in Labwindow, but err happened when called in LabVIEW showing failed to open the given file from the return value. How to know the filename and path aready passed to DLL with correct format?
Any suggestion will be greatly appreciated!
Frank
02-07-2007 01:48 AM
@xiejiezhou wrote:
thanks,
I have written a DLL with Labwindow that it can be called by LabVIEW to search some given paramters in a given file. The input include two paratmeter file & path and some string like as "paragraph". The output should returns three parameters we will use. This function work fine in Labwindow, but err happened when called in LabVIEW showing failed to open the given file from the return value. How to know the filename and path aready passed to DLL with correct format?
Any suggestion will be greatly appreciated!
Frank
A LabVIEW path is a special data type whose format is actually privat and therefore only understandable for LabVIEW itself.
Before passing it to the Call Library Node convert it to a string with the Path To String function and then pass this a s a C style string pointer in the Call Library Node.
For the rest, Georges recommandation to have LabVIEW create the function protoype as you have configured it is a good one. You can go from there or at least use it to compare what you have with what LabVIEW thinks it should be according to your CLN configuration.
Rolf Kalbermatter
02-07-2007 08:13 PM
02-08-2007 01:55 AM
@xiejiezhou wrote:
Thank Georges and Rolf Kalbermatter,I changed the runtime support with " Full Runtime Engine" instead of " LabVIEW Real-Time Only" before, it's work now, but the output parameters returned are irregular incorrect characters. My funciton prototype is:DLLEXPORT long CollectParameter(char *NomFile, char *szNomParagraph, char *Command[], char *Type[], char *Value[])so how to configure the type in LabVIEW respectively? I tried every types, just "c String Pointer" is ok, but returned value irregular & incorrect.As Geogre's suggestion, i should add my code as below function generated by LabVIEW, is it?ong CollectLabel(char szNomFile[], char szNomParagraph[], char Command[], char Type[], char Value[])
{/* Insert code here */}Frank
The char *Command[], char *Type[], char *Value[] parameters are parameters that you can not create with LabVIEW. This are arrays of strings and and LabVIEW has a completely different idea about how to place strings and arrays in memory than what is used in C.
And while LabVIEW supports translation of the top level type to C compatible pointers it does not have any option to let you configure it to translate embedded elements in parameters (the strings in the array) to be translated too.
But to be honest what you seem want to do is read in a file, do some parsing and then return parameters taken out of that file. Doing that all in LabVIEW would be SOOOOOOOOOOOO much easier.
Rolf Kalbermatter
02-08-2007 02:28 AM
02-08-2007 08:55 AM
02-09-2007 01:16 AM
Thank very much, i got it.
Frank