Jump to content
John S

How To Create An Lib File From My C Files.

Recommended Posts

Hi,

Can someone show me how to make *.lib file from my C file. I need to know this to increase the compile time.

 

Cheers

John

Share this post


Link to post
Share on other sites

Hi

 

You just have to change the build type and include <boostc.h> instead of <system.h>.

You can find it under librarian" at the BoostC reference manual, under "compilation model and toolchain" @ pages 13 and 14.

 

 

 

As they use to say RTFM!

 

 

Best regards

Jorge

Share this post


Link to post
Share on other sites

Thanks Jorge,

 

I have read the manual but it I can't find the explanation for using the -lib in command line mode.

 

Page 24 gives only this info

 

Switches for making libraries:

-lib make library file from supplied .obj and .lib files

-p name project (library output file) name

 

Can I make lib file from the *.obj file that has been already created in my project?

BTW I have never used Sorceboost IDE, anyway I will give it a try.

 

Thanks

John

 

For example in GCC for ARM linux

gcc -c FlashMem.c (to create obj file)

ar rvs FlashmemLib.a FlashMem.o (to create library file)

Share this post


Link to post
Share on other sites

Hi

 

You missed this from page 14...

Librarian is built into BoostLink linker...

and

There is a dedicated box in the Option dialog inside
SourceBoost IDE that changes project target to library...

 

Setup your project with the Sourceboost IDE, you can share the same source files you are using with MPLAB or whatever IDE you are using.

Go to "settings -> options" and change the output type to library.

 

 

EDIT ADD:

When setting up the project in the Sourceboost IDE, add only the source and header files of the modules you want to include in the library.

When building the compiler will generate the usual object files and the linker aggregates them in a single library file.

Don't forgett to include "boostc.h" instead of "system.h" if you want a device independent library.

 

 

Best regards

Jorge

Edited by JorgeF

Share this post


Link to post
Share on other sites

Hi

 

 

Some more info.

When you set the output type to library, the IDE automatically adds the "-lib" switch to the command line, as you can verufy in the output window.

 

Otherwise you could do it by hand, just adding the switch to the etxt box "extra linker options".

This can also be done with any other IDE, they all have a way to add command line options for the compiler or linker.

 

 

When you use the "gcc" toolchain you have a traditional environment where the "linker" and the "librarian" (ar) are separate programs. In the BoostC toolchain the "librarian" is included in the "linker".

 

 

 

Best regards

Jorge

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×