# Difference and use of .LIB vs .DLL

**URL:** <https://clarionhub.com/t/difference-and-use-of-lib-vs-dll/4350>\
**Category:** questions\
**Tags:** c10, c11\
**Created:** [July 29, 2021, 8:11pm UTC](https://clarionhub.com/t/difference-and-use-of-lib-vs-dll/4350 "2021-07-29T20:11:08Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [July 30, 2021, 4:37am UTC](https://clarionhub.com/t/difference-and-use-of-lib-vs-dll/4350/7 "2021-07-30T04:37:18Z")

</div>

> [@Trevor\_Leybourne](#):
>
> if you delete all .LIB and .DLL files you cannot re-compile the system as the compilation process wants to reference the various .LIB files which have not been built yet and so there is a compilation ERROR (not warning).

The LIB files are made from the EXP files. You can make all the LIB files with a project that uses #implib as described in the below link. You need to generate APPs to make the EXP files which I do with a BAT file running ClarionCL.exe which is also covered in this topic

> [@Msbuild example for Clarion](https://clarionhub.com/t/msbuild-example-for-clarion/274/8):
>
> Dave’s article had the correct syntax of #implib LIB EXP, it was wrong as #implib EXP LIB in the excerpt from page 130 of AdvancedTopicsReferenceGuide.pdf, the example projects in that PDF do show correctly e.g. #implib %%drvname%%.LIB %%drvname%%.EXP. The wrong syntax will trash your EXP and not give you a LIB. I attached a corrected DLL Tutor example project to generate LIBs with the bwlow syntax. There’s not need to do AllFiles since if it is the first one built. #implib ALLFILES.LIB ALLFIL…

This post is also good putting LIB with DLL files in the Project folder. Clarion’s default setup puts the LIB in OBJ which tends to cause problems.

> [@Editing Default Redirection RED file to create .LIB with .DLL in project folder](https://clarionhub.com/t/editing-default-redirection-red-file-to-create-lib-with-dll-in-project-folder/1646/3):
>
> This is one of the best tips ever! A picture may make this easer than reading. Add the .Lib in 2 places: [Debug] and [Release]

> [@Trevor\_Leybourne](#):
>
> So if my project is setup to use .DLLs why does the compiler need to reference the .LIB files during compile time? And does it actually make use of the .LIB file in any way?

Technically the LIB file is not for the Compiler its there for the Linker to verify a procedure name you entered exists in that library. If the Linker cannot find a matching name you get an Unresolved External error.

In Windows procedure names are case sensitive but not in Clarion. The LIB has the exact case sensitive name for the Linker to lookup and place in the EXE / DLL PE Import Table. That is another purpose of the EXP file to provide case sensesitive names for the LIB and DLL PE Export Table. App generation makes names all UPPER in the EXP but they don’t have to be.

---

_[View the full topic](https://clarionhub.com/t/difference-and-use-of-lib-vs-dll/4350)._
