Support Note

Are the import libraries corrupt?


Questions: I try to link my application with the import libraries supplied with the CANLIB SDK, but I get an error message telling me that the libraries are corrupt. Why?
Answer: There might be several reasons, but her are a few:
1. Borland C++ and Microsoft C++ are using different formats for the import libraries. If you are using Microsoft Visual C++, you should use the libraries in LIB\MS, and if you are using a Borland compiler, such as Borland C++Builder, you should use the libraries in LIB\Borland.

2. Microsoft changed their library format between version 5 and version 6 of their compiler. The libraries in CANLIB SDK 3.1 and newer are created using Microsoft Visual C++ V6. Apparently Visual C++ V5 has problems with reading these libraries, unless all service packs for Visual C++ V5 are applied.  A workaround is to get access to a computer where Visual C++ V6 is installed and create a V5-compatible library like this:
lib /verbose /link50compat /convert canlib32.lib /out:canlib32_v5.lib
From CANLIB SDK 3.2 and on we will create the libraries using the /LINK50COMPAT switch.
In the unlikely event that the import libraries supplied with the CANLIB SDK really are unusable, for example, if a new release of a compiler, linker or other tool requires a new format, you might create the import libraries yourself. 

3. Users of Borland C might use the IMPLIB utility to create import libraries from a DLL such as CANLIB32.DLL. Please refer to Borland's documentation. Be sure to specify the -f flag to implib to force "import by name", or you will have problems when more functions are exported in future versions of the DLL inquestion.

4. Users of Microsoft C will find detailed instructions on how to create
import libraries in the Microsoft Knowledgebase; go to http://support.microsoft.com and search for article ID Q131313.

5. If you are using an old version (older than 3.x) of CANLIB SDK, you should be aware of the fact that 16-bit DOS libraries for PCcan are included in it. If you try to link a 32-bit application with a 16-bit library you will see strange error messages. The 16-bit libraries were named CANLIB.LIB and CANL.LIB. The 32-bit library is named CANLIB32.DLL.

Contact our Support Team.

Back to Support Notes Index >>

 


© Kvaser AB - All rights reserved | Contact us | Webmaster | Sitemap
Direct link to this page: