CANlib supports 32- and 64-bit programs.
The APIs named canXXX and kvXXX are defined in canlib32.dll.
C, C++ (Microsoft Visual Studio, Embarcadero RAD Studio)
Embarcadero and Microsoft have different formats for the import libraries - be sure to pick the correct one; CANlib SDK is shipped with both versions. For Microsoft compilers, it is worth noting that the import library shipped with CANlib SDK is compatible with Visual C++ 5.0 or later.
We haven't tested it ourselves, but we hear that people have had success with CodeWarrior, Watcom and gcc compilers as well.
Embarcadero Delphi (2.0 or later)
Use the CAN unit if you want to use the CANlib API directly; this means:
The unit will dynamically load (with a call to the Windows API function LoadLibrary
) the appropriate DLL, which is canlib32.dll for 32-bit programs. There is also a VCL component, TCanChannelEx
, that may make your life a little bit easier.
Microsoft Visual Basic, 5.0 or 6.0
Include canlib32.bas in your project. We have included a sample program that is tested with VB5. VB4 users should be able to use the program code (in the .FRM file) by some cutting-and-pasting.
Microsoft C#, or Microsoft Visual Basic .NET
See the C# sample in SAMPLES.
Other languages
canlib32.dll is a standard Windows DLL, and all entry points are using the Windows stdcall calling convention. This means it should be callable from any other language. Please refer to your language manual to obtain information on how to link to a standard Windows DLL.
The APIs named kvaDbXXX are defined in kvaDbLib.dll.
C/C++ code that uses these APIs should
The APIs named linXXX are defined in linlib.dll.
C/C++ code that uses these APIs should
The APIs named j1587XXX are defined in j1587lib.dll.
C/C++ code that uses these APIs should
Borland and Microsoft have different formats for the import libraries - be sure to pick the correct one; CANlib SDK is shipped with both versions. For Microsoft compilers, it is worth noting that the import library shipped with CANlib SDK is compatible with Visual C++ 5.0 or later.
DLL | .Net Standard | Dependencies |
---|---|---|
dotnet\win32\netstandard2.0\Kvaser.CanLib.dll | v2.0 | Bin\canlib32.dll |
dotnet\win32\netstandard2.0\Kvaser.KvaDbLib.dll | v2.0 | Bin\kvadblib.dll |
dotnet\win32\netstandard2.0\Kvaser.KvlcLib.dll | v2.0 | Bin\kvadblib.dll, Bin\kvlclib.dll, Bin\kvmlib.dll |
dotnet\win32\netstandard2.0\Kvaser.KvmLib.dll | v2.0 | Bin\kvmLib.dll |
dotnet\win32\netstandard2.0\Kvaser.KvrLib.dll | v2.0 | Bin\kvrlib.dll |
dotnet\win32\netstandard2.0\Kvaser.LinLib.dll | v2.0 | Bin\linlib.dll |
dotnet\win32\netstandard2.0\Kvaser.MemoLibXML.dll | v2.0 | Bin\kvaMemoLibXML.dll |
Bin\kvlclib.dll | - | Bin\kvadblib.dll, |
Bin\kvmlib.dll | - | Bin\kvamemolib.dll, Bin\kvaMemoLib0600.dll, Bin\kvaMemoLib0700.dll |
Bin\coti.dll Bin\j1587lib.dll Bin\j2534\kvj2534c.dll Bin\j2534\kvj2534i.dll Bin\j2534api.dll Bin\linlib.dll Bin\rp1210\kv121032.dll | - | Bin\canlib32.dll |
Bin\kvrlib.dll | - | Bin\canlib32.dll, Bin\irisdll.dll, Bin\irisflash.dll, Bin\libxml2.dll(statically linked with zlib, iconv) |
DLL | .Net Standard | Dependencies |
---|---|---|
dotnet\x64\netstandard2.0\Kvaser.CanLib.dll | v2.0 | bin_x64\canlib32.dll |
dotnet\x64\netstandard2.0\Kvaser.KvaDbLib.dll | v2.0 | bin_x64\kvadblib.dll |
dotnet\x64\netstandard2.0\Kvaser.KvlcLib.dll | v2.0 | bin_x64\kvadblib.dll, bin_x64\kvlclib.dll, bin_x64\kvmlib.dll |
dotnet\x64\netstandard2.0\Kvaser.KvmLib.dll | v2.0 | bin_x64\kvmLib.dll |
dotnet\x64\netstandard2.0\Kvaser.KvrLib.dll | v2.0 | bin_x64\kvrlib.dll |
dotnet\x64\netstandard2.0\Kvaser.LinLib.dll | v2.0 | bin_x64\linlib.dll |
dotnet\x64\netstandard2.0\Kvaser.MemoLibXML.dll | v2.0 | Bin_x64\kvaMemoLibXML.dll |
bin_x64\kvlclib.dll | - | bin_x64\kvadblib.dll, Matlab dll:s libmat.dll, libmx.dll, libut.dll and their dependencies (located in the bin_x64 directory) The Matlab dll:s require the Visual C++ Redistributable Package for Visual Studio 2013 (https://www.microsoft.com/en-us/download/confirmation.aspx?id=40784) to be installed. |
bin_x64\kvmlib.dll | - | bin_x64\kvamemolib.dll, bin_x64\kvaMemoLib0600.dll, bin_x64\kvaMemoLib0700.dll |
bin_x64\j1587lib.dll bin_x64\j2534api.dll bin_x64\linlib.dll | - | bin_x64\canlib32.dll |
bin_x64\kvrlib.dll | - | bin_x64\canlib32.dll, |
As an application programmer, you may want to distribute canlib32.dll together with your application. If you choose to do so, you should place it in the application's directory. In this way you will not break any other applications on the computer.
If you install canlib32.dll on the target system, and the rest of the device drivers are not installed, any call you make to canlib32.dll will return an error code. You should be prepared for this situation and handle the error code in a constructive way in your application. Another situation could be that the deployed application is using a new canlib32.dll function, as this also would require an update of the drivers it’s important to implement error handling in such a way that the application will inform the user to update their drivers.
A version mismatch between canlib32.dll and drivers will return the error code: canERR_DYNALIB, please see Error checking for further reading about error handling.
It is also possible to programmatically install the required device driver without user intervention.
The following files included in the CANLIB SDK may be redistributed with your application, provided they are only used together with genuine Kvaser hardware.
You may use and distribute the source code found in the SAMPLES directory in your own applications without restrictions.
Please contact Kvaser Support if you would like to redistribute any file not found in this list.