Why does my LabVIEW VI sometimes fail to find the Kvaser hardware?

ago10 years by Jesse Paliotto

When you call kvCanInitializeLibrary.vi in your application, the driver determines what hardware is attached to the PC and assigns channel numbers.  The driver will not recognize any additional hardware until the dynamic link library (DLL) is unloaded.  This would normally happen when the application exits.  However, Windows associates the DLL with LabVIEW – not the running VI.  Therefore, the DLL is not unloaded until LabVIEW is completely exited.

So, if you run your VI until the VI exits, then attach Kvaser hardware.  When you run the VI again, the newly attached Kvaser hardware will not be recognized unless you completely exit LabVIEW first.

If you would like to unload the DLL within you VI, you can create a VI wrapper for the canlib32.dll function canUnloadLibrary().