04-29-2022 01:23 AM
1. I am generating deep learning DLL from MATLAB. DLLs are running fine in LabVIEW project. When I tried to build application of the VI containing DLL, the application starts crashing. I added the DLL in "Always included" option of source files while building application.
This problem is specific to deep learning DLLs, when i built a simple a+b DLL in MATLAB and built its application in LabVIEW, it is working fine.
2. Another issue is that sometimes when calling deep learning DLL, LabVIEW itself starts crashing. Restarting or changing the LV folder solves it.
04-29-2022 04:05 AM
Such errors can basically mean two things only. An actual bug in the DLL itself (not so likely here as it is Matlab generated DLL but never totally impossible) or an error in how you configured the Call Library Node to call one or more of these functions.
The fact that it doesn’t always crash is not relevant here! Somewhere you do incorrectly pass a buffer to the DLL that the DLL then tries to write into and either the datatype of that buffer doesn’t match what the DLl function expects or the bounds you provide are incorrect, causing the function to write beyond the valid area of that buffer and corrupting memory used for other things.
The only valid course of action is to go and review every single Call Library Node and make sure the configuration matches the actual function prototype exactly. Also if you pass in arrays or matrices to functions that the function is supposed to write into you have to create (allocate) them first with helper functions that Matlab created for you and added to your DLL. And any such buffer needs to be deallocated by a corresponding helper function afterwards.