LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking to external DLLs

I am trying to link to an external dll from Robotis--the dll is part of the dynamixel_sdk. I went through the import procedure, and the functions show up in the function pallet,  but I cannot get the functions to work. I get the error shown below, which I understand is not uncommon, but even after configuring the Call LIbrary Function node, I still get the error.

 

I'm new to LabView, so I'm struggling a bit with this. Any advice or help would be welcomed. Please keep the response simple. 🙂

 

Thanks so much!

 

 

DeepSpace_0-1606358597360.png

 

DeepSpace_1-1606358663708.png

 

 

 

0 Kudos
Message 1 of 5
(1,643 Views)

I do not have the exact answer for that, but I would recommend to "Run it in any thread" and also check the bit compability of the dll, by that I mean if you have a 64bitsdll running it on LV32bits that would make errors or visce-versa.

0 Kudos
Message 2 of 5
(1,600 Views)

@ederzer wrote:

I do not have the exact answer for that, but I would recommend to "Run it in any thread" and also check the bit compability of the dll, by that I mean if you have a 64bitsdll running it on LV32bits that would make errors or visce-versa.


If the bitness doesn't match LabVIEW can not even load the DLL, so a runtime error would be out of question. The function that is shown is also trivial enough and the calling convention seems to be correct too in respect to the GITHUB source I can see for that DLL. So I'm a bit lost at what could be the problem if it is for the setBaudrate() function as shown by the OP. The only thing I could imagine is that you first have to call an initialize function of some sorts before you are allowed to call other functions in the DLL.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 3 of 5
(1,592 Views)

In fact it seems you need to call portHandler() first with the correct port name before trying to access any other function. The return value of the portHandler() function needs to be used as port num parameter to all other functions. Without calling portHandler() first or passing any number as port num not returned by a portHandler() call, all those functions will without any protection directly attempt to access illegal memory which fully explains the 1097 error,

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 4 of 5
(1,583 Views)

Rolf,

 

Thank you for these good hints. Now that the holiday is over, I will be back working on this project. I appreciate all you replies.

 

Regards,

 

 

0 Kudos
Message 5 of 5
(1,556 Views)