LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Library Function Node.vi using problem

Hi, 
 
 我用Labwindows 编了个读文件的程序然后生成动态库, 然后在LabVIEW里调用该动态库(Call Library Function Node), 即向该动态库传递文件名及路径和某一字符串,然后该动态库打开相应路径文件从中读出并返回三个参数值,可是每次的返回值总显示打开文件失败, 该函数在Labwindow里没有问题. 在LabVIEW里如何调试来确定传到动态库的参数格式是没有问题的呢?任何的指点迷津,不胜感激!
 
 
Frank,
 
0 Kudos
Message 1 of 11
(4,392 Views)
Could you try to rephrase your question in Western letters and preferable English so that more people could help you?
 
Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 11
(4,374 Views)
I translate your post using Google Smiley Wink for those can't read Chinese.
>I read documentation procedures before using Labwindows Bianlege generated DLL, Lane then call the DLL in LabVIEW (Call Function
>Library Node), and to the dynamic transmission path and file name of a string. Then open the corresponding dynamic routing document
>from the Secretary read out the three parameters and return values. However, the return value of each open document shows the total
>failure. Labwindow has no function in the problem. in LabVIEW to determine ways to spread the dynamic debugging there is no problem
>with the format of the parameters? Any Ariadne, be grateful!
 
 
It seems you have problem to use a LabWindow dll in LabVIEW.
The data types in LabVIEW are different from those in LabWindow.
I recommand you do the reverse: in LabVIEW, right click the Call Function Library Node, and select "Create .c File...".
Then open the .c file in LabWindow, reprogram your dll to match LabVIEW data type.
 
George Zou
 
George Zou
Message 3 of 11
(4,359 Views)

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

0 Kudos
Message 4 of 11
(4,354 Views)


@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

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 11
(4,349 Views)
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
0 Kudos
Message 6 of 11
(4,330 Views)


@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

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 7 of 11
(4,318 Views)
Hi Rolf,
 
   Thank for your answer, because i am just a beginner of LabVIEW,  not so good at using it.  Where to find some examples about reading &writing files or could you give me some example about this? You can read the attached file to understand what i want to do.
   Thank in advance!
 
 
  Frank
0 Kudos
Message 8 of 11
(4,315 Views)
LV does has plenty of splendid example code about  file operation. You can get it by "Find Examples".
Cheng Yang
0 Kudos
Message 9 of 11
(4,306 Views)

Thank very much, i got it.

Frank

0 Kudos
Message 10 of 11
(4,294 Views)