01-10-2008 07:50 PM
01-10-2008 10:36 PM
01-11-2008 01:44 PM
01-11-2008 01:49 PM
01-11-2008 03:16 PM
01-17-2008 10:48 AM
01-17-2008 10:57 AM
Sometimes errors are caused by selecting the wrong Calling Convention. The two choices are C and WINAPI. Try both.
01-17-2008 11:08 AM
Hi Safe,
The error you're encountering has the following description (I'm sure you've already looked this up-posting here for clarity for other readers):
LabVIEW: An exception occurred within the external code called by a Call Library Function Node. This might have corrupted LabVIEW's memory. Save any work to a new location and restart LabVIEW.
Typically, this happens for one of just a few reasons:
I've attached some pictures of how I'd configure the dialog, but there are two critical things you have to know: calling conventions and thread safety. Those are things defined by the DLL. In Windows, C vs. 'Standard' (a.k.a. Pascal) calling conventions MUST be correct, as they affect how arguments are passed on the stack. If this is wrong, then, for example, where arg1 is expected to be an unsigned char *, you may actually only pass an unsigned char. Dereferencing that number as a pointer will at best crash, at worst appear to be a valid address and silently corrupt memory.
I suggest double-checking the calling conventions. 'stdcall' is still quite common, but not the default setting in the Call Library Function dialog.
Best regards,
intvstefve
01-17-2008 11:33 AM
Hi Invsteve,
Thanks, and yes I have read the code, but you gave me a good detailed information about the error. I know it has some thing to do with calling conventions. So I did exaclty as you did and i have the attachments to show it. Can but the function in the bottom is still not char pointer.
maybe you see something that I don't, thanks for your help...I know soon we will find the problem.
Thanx,
Safe
01-17-2008 11:45 AM
Whether it's 'unsigned uint8_t *' or 'unsigned char *' or int8_t*' shouldn't cause an exception -- they are all pointers to blocks of data containing 1-byte sized elements.
I am curious how you're sizing the array you send in. Do you have an array on the diagram you've initially sized, then pass the 'array size' value as the third argument? And, I presume that both 'H' and 'L' are the same size (Len)?.
Also, in your first post, you indicated a function prototype of:
void Function_Name(unsigned char *L, unsigned char *H, unsigned in Len, unsigned char Adr);
I'm assuming that 'Len' is an unsigned int, which you've properly set to a uInt32... is the fourth argument a char or a 32-bit integer? Again, passing the wrong argument by value (a uInt32 vs. a uInt8) will mess up the stack, and cause trouble.
Best regards,