From: rolfk on
lmd2 wrote:No good, the function still returns the same error: Invalid BufferI am attaching the diagram, don't see how the buffer could be better initializedSometimes APIs require passed in buffers to be initiliazed specifically. This means that some data members may need to be set to different values than 0. What you do right now, passing a cluster of all 0 values, is still equivalent to simply passing in an array of 0 values.Rolf KalbermatterMessage Edited by rolfk on 07-03-2008 06:58 AM
From: lmd2 on
Well in the C code, malloc seems to point/reference the STRUCT definition (from the header file) which is un-initialized; but I will confirm with the client if the malloc requires an initialized STRUCT. (but due to the holiday weekend here in the states I probably won't get a reply until Monday) Thanks for sticking with this, lmd2Message Edited by lmd2 on 07-03-2008 03:47 AM
From: rolfk on
lmd2 wrote:Well in the C code, malloc seems to point/reference the STRUCT definition (from the header file) which is un-initialized; but I will confirm with the client if the malloc requires an initialized STRUCT. (but due to the holiday weekend here in the states I probably won't get a reply until Monday)Thanks for sticking with this, lmd2Message Edited by lmd2 on 07-03-2008 03:47 AMmalloc() is indeed NOT guaranteed to initialize the memory at all. Fro that you would need calloc. But you have not shown much of your code oder than how you allocate your buffer. Not event the function call. After all there might be some assignments to structure elements between the malloc and the function call or what about other function parameters that might be considered invalid and cause this error code?Rolf Kalbermatter
From: lmd2 on
this function is part of a device driver, and can not run alone, here is a small sample app that uses this function, and others (initialize, configure, ...) also the header file where the STRUCT is defined, and a page out of the user manual defining this function. I didn't expect you to get into it this deeply, thanx


mtiop.h:
http://forums.ni.com/attachments/ni/170/337400/1/mtiop.h


aceMTIGetCh10DataPkt.doc:
http://forums.ni.com/attachments/ni/170/337400/2/aceMTIGetCh10DataPkt.doc


mtidemo.c:
http://forums.ni.com/attachments/ni/170/337400/3/mtidemo.c
From: lmd2 on
here is the same sample app in LabVIEW (not an elegant architecture, but the client wants a literal translation from C to LabVIEW)The sample crashes at this function, and returns INVALID BUFFER if you actually wish to run it I can post the distribution for the DLL as well


MTIDemo.llb:
http://forums.ni.com/attachments/ni/170/337401/1/MTIDemo.llb
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10
Prev: error 200279
Next: CMD.EXE Output Not Showing up