10-03-2018 09:17 AM
Thank you for the suggestions! It is working now with the calling convention changed to WINAPI and some added delay (500ms) between calls. It appears the conversion to VIs was successful and only the timing and calling convention were off. I still get the 1097 error sometimes but the hardware responds properly and reproducibly.
Thanks for the help!
10-04-2018 05:24 AM - edited 10-04-2018 05:30 AM
A 1097 error means that LabVIEW detected something bad during the external function call such as stack corruption (unlikely as that usually tends to crash immediately) or memory corruption because the DLL overwrites memory that it should not.
That may seem to have no noticable influence and you may be lucky that it corrupts only memory that is not actively used, but that can change at any time when you recompile. Or it does not corrupt memory where important LabVIEW data structures are allocated, and hence does not generate invalid pointers, but it may be the data buffer where your measurement data from another function is located and you start wondering why the value magically is modified at random moments.
Whatever corruption it causes the nature of it can change with any modification to your application, which almost always changes the memory layout of your application in some ways and suddenly your application starts to crash at random moments.
Also note that LabVIEW can not detect every possible memory corruption, but if it does there is definitely something wrong! So ignoring a 1097 error on DLL calls is a serious stability and security problem in EVERY single situation.
On the other hand if you work with the Call Library Node, absence of any crashes and 1097 errors is absolutely no guarantee that everything is alright!
Whenever you encounter a crash in LabVIEW and you use any Call Library Nodes anywhere, that is almost always the first thing you need to investigate. If the VIs containing the Call Library Node come from NI, you can usually safely assume that they are pretty well tested in that respect but if they come from anyone else, be very wary especially if they are inhouse developed or picked from some community resource created by people who know enough to be dangerous but not enough to know that they are dangerous
10-04-2018 05:37 AM
Thanks for the detailed explanation. I will investigate more carefully and watch out for any unexpected behaviour.