Kvaser CANLIB: Compiling and Linking Your Code

Compiling and Linking Your Code

CANLIB supports 32- and 64-bit programs running on Windows XP, Vista, Windows 7 and Windows 8.

canXXX and kvXXX APIs

The APIs named canXXX and kvXXX are defined in canlib32.dll.

C, C++ (Microsoft Visual Studio, Embarcadero RAD Studio)

  • Include canlib.h.
  • Link with the import library canlib32.lib.

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:

  • Put it in a uses clause in your program.
  • Include it in the project.

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.

CAN Database API - kvaDbXXX

The APIs named kvaDbXXX are defined in kvaDbLib.dll.

C/C++ code that uses these APIs should

  • Include kvaDbLib.h
  • Link with the import library kvaDbLib.lib

LIN API - linXXX

The APIs named linXXX are defined in linlib.dll.

C/C++ code that uses these APIs should

  • Include linlib.h.
  • Link with the import library linlib.lib

J1587 API - j1587XXX

The APIs named j1587XXX are defined in j1587lib.dll.

C/C++ code that uses these APIs should

  • Include j1587lib.h.
  • Link with the import library j1587.lib

Library formats

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 dependencies

Lists all CLSNET wrappers and specifies the dependencies and runtime version for .NET development.

32-bit DLL dependencies

DLL .NET Framework VersionDependencies
dotnet\win32\fw11\canlibCLSNET.dll v1.1.4322 Bin\canlib32.dll
dotnet\win32\fw40\canlibCLSNET.dll v4.0.30319 Bin\canlib32.dll
dotnet\win32\fw40\kvadblibCLSNET.dll v4.0.30319 Bin\kvaDbLib.dll
dotnet\win32\fw40\kvrlibCLSNET.dll v4.0.30319 Bin\kvrlib.dll
dotnet\win32\fw40\linlibCLSNET.dll v4.0.30319

Bin\linlib.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)

64-bit DLL dependencies

DLL .NET Framework VersionDependencies
dotnet\x64\fw40\canlibCLSNET.dll v4.0.30319 bin_x64\canlib32.dll
dotnet\x64\fw40\kvrlibCLSNET.dll v4.0.30319 bin_x64\kvrlib.dll
dotnet\x64\fw40\linlibCLSNET.dll v4.0.30319

bin_x64\linlib.dll

bin_x64\j1587lib.dll
bin_x64\j2534api.dll
bin_x64\linlib.dll
-

bin_x64\canlib32.dll

bin_x64\kvrlib.dll - bin_x64\irisflash.dll,
bin_x64\canlib32.dll,
bin_x64\irisdll.dll,
bin_x64\libxml2.dll (statically linked with zlib, iconv)