CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Is it possible to make compiled library?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pickup



Joined: 22 Jun 2013
Posts: 9

View user's profile Send private message

Is it possible to make compiled library?
PostPosted: Sun Oct 19, 2014 3:46 pm     Reply with quote

Hello,

Is it possible to create compiled library? For example mikroC PRO has an option as "Build all files as library".

Regards.
Ttelmah



Joined: 11 Mar 2010
Posts: 19238

View user's profile Send private message

PostPosted: Mon Oct 20, 2014 12:38 am     Reply with quote

Yes, but don't.....

It is possible with the current compilers to generate a file, and link this.
Look at #EXPORT & #IMPORT, and particularly the relocatable option for this.
Historically this had problems, but does now work properly.

However CCS has a very efficient optimiser, and doing this, prevents quite a lot of the optimisation. Functions, and RAM space used in the module, which if it is compiled as source, with the main code, get optimised, do not get re-used in the same way if this is done.

I found on a project that compiled to 48Kwords (on a PIC33), took over 50Kwords if the main I/O functions were separately linked, and RAM use also grew by about 5%.
pickup



Joined: 22 Jun 2013
Posts: 9

View user's profile Send private message

PostPosted: Mon Oct 20, 2014 11:27 am     Reply with quote

Aha Ttelmah!!!!! It's very good to get your answer Very Happy. You are the guru of CCS. And you also helped me before. Thanks a lot.

Well, I did not understand how to make compiled library. But I shall read what you have mentioned and try to understand. An example or step by step guide would be very helpful. Just one simple function like

int add(int x, int y){
return(x + y);
}

Best regards.
Ttelmah



Joined: 11 Mar 2010
Posts: 19238

View user's profile Send private message

PostPosted: Mon Oct 20, 2014 12:28 pm     Reply with quote

Look at the file mcu.zip in the examples directory. It contains a complete example of a set of routines, and loading these from the main code. Look in the manual at the linker section which tells you how to use this.
pickup



Joined: 22 Jun 2013
Posts: 9

View user's profile Send private message

PostPosted: Tue Oct 21, 2014 3:25 pm     Reply with quote

Thanks a lot guru Surprised

Very interesting, I am reading.... I did not know about this file - mcu.zip.

Take care.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group