andreima Posted July 19, 2010 Report Share Posted July 19, 2010 Hi I have a problem pass cluster to structure in DLL. I am work with Labview 7.0. structure in DLL: Struct OutData { Unsigned long CobID; Unsigned char NByte; Unsigned char Data[8]; Unsigned long Time;} Quote Link to comment
Saverio Posted July 19, 2010 Report Share Posted July 19, 2010 Your data cluster contains 9 elements, but the prototype indicates it's only 8 elements. So, you've got one too many elements in your cluster. Also, have you changed the datatype for the NType element to U8, as well as the individual elements of the data cluster? Quote Link to comment
andreima Posted July 20, 2010 Author Report Share Posted July 20, 2010 Your data cluster contains 9 elements, but the prototype indicates it's only 8 elements. So, you've got one too many elements in your cluster. Also, have you changed the datatype for the NType element to U8, as well as the individual elements of the data cluster? It did't help.My problem is to pass Cluster to Dll structer (not pointer to structer) Quote Link to comment
spaghetti_developer Posted July 20, 2010 Report Share Posted July 20, 2010 It did't help.My problem is to pass Cluster to Dll structer (not pointer to structer) But are you sure that you have to pass the parameter as pointer? Did you try to pass the cluster without converting it as pointer? Quote Link to comment
andreima Posted July 20, 2010 Author Report Share Posted July 20, 2010 But are you sure that you have to pass the parameter as pointer? Did you try to pass the cluster without converting it as pointer? I am pass cluster (not pointer to cluster)from Labview to DLL ( function prototype in DLL is "uint32 Function_name(struct OutData)" ) but I think that I pass pointer to cluster from Labview to DLL by Call Library Function window (see attachment pic.) Quote Link to comment
spaghetti_developer Posted July 20, 2010 Report Share Posted July 20, 2010 I suggest reading this topics: http://decibel.ni.com/content/docs/DOC-9080 http://zone.ni.com/devzone/cda/epd/p/id/3672 may they can help you. Quote Link to comment
Saverio Posted July 20, 2010 Report Share Posted July 20, 2010 (edited) Why are you trying to pass a pointer to a structure? The function prototype uint32 Function_name(struct OutData) clearly does not indicate that you're supposed to pass a pointer to a structure! Also, you seem to be dealing with a C++ DLL, as the name mangling shows. Please review the articles on the NI site and in the LabVIEW Help regarding calling C++ DLLs and name-mangling issues. If you are trying to call other functions you may not be able to see them due to the name mangling that occurs with C++ DLLs. Edited July 20, 2010 by Saverio Quote Link to comment
andreima Posted July 20, 2010 Author Report Share Posted July 20, 2010 Why are you trying to pass a pointer to a structure? The function prototype uint32 Function_name(struct OutData) clearly does not indicate that you're supposed to pass a pointer to a structure! Also, you seem to be dealing with a C++ DLL, as the name mangling shows. Please review the articles on the NI site and in the LabVIEW Help regarding calling C++ DLLs and name-mangling issues. If you are trying to call other functions you may not be able to see them due to the name mangling that occurs with C++ DLLs. How I must configure Call Library Function Node in Labview for pass stuct OutData from Labview to DLL(The function prototype : uint32 Function_name(struct OutData) )? I am try 2 option: * 1 option: I am pass cluster. Call Library Function Node configuration: Type: Adapt to Type Data format: Handles by Value I am bild cluster whith u32 CobID; u8 NByte; u8 array [8]; u32Time; The all data pass wrong * 2 option: I am pass 4 variable: u32 CobID; u8 NByte; u8 array [8]; u32Time; Call Library Function Node configuration: CobID Type: Numeric Data type: U32 int Pass: value NByte Type: Numeric Data type: U8 int Pass: value array Type: array Data type: U8 int Pass: array data pointer Time Type: Numeric Data type: U32 int Pass: value The CobID and NByte were correct but array and Time were wrong. I am can't change the DLL. I am start work with Labview 9.0 and now its did't crash. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.