More library antics (1.95beta)...

Beta Testing discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Sobrietytest
Posts: 619
Joined: 05 Jul 2008 06:05
Location: Thailand

More library antics (1.95beta)...

#1 Post by Sobrietytest » 12 Dec 2009 05:59

I'm rebuilding a old project on the new compiler, this includes Mmc_FAT (SPI1), SPI2, Soft I2C and UART on a 24FJ128GA010. I have got everything to compile except the Mmc.

Yesterday I noticed that the compiler threw numerous errors like this...

Image

I had already included the Mmc_fat library but most of the errors seemed to be related to non-FAT Mmc functions, so I included that library too. This corrected all the errors and everything compiled. Is it always necessary to load the Mmc library with the Mmc_fat library?

This morning I loaded the license key and reran the compiler with exactly the same code and libraries and I'm getting these errors again...

Image

???

ST.

User avatar
marko.ziv
mikroElektronika team
Posts: 531
Joined: 06 Dec 2007 10:11
Contact:

Re: More library antics (1.95beta)...

#2 Post by marko.ziv » 12 Dec 2009 08:51

Hi,
Sobrietytest wrote: This morning I loaded the license key and reran the compiler with exactly the same code and libraries and I'm getting these errors again...

Image


ST.
islower and toupper are functions located in the C_Type library. Checking that in Library manager should resolve this error messages.

Best Regards

VCC
Posts: 463
Joined: 08 Jun 2009 18:31
Location: Romania

#3 Post by VCC » 12 Dec 2009 09:33

Hi marko.ziv, would it be hard to implement a mechanism that parses the error message to extract the unresolved function name and based on that to automatically check the corresponding library from Library Manager ?
Thank you. :D

pwdixon
Posts: 1431
Joined: 13 Apr 2005 11:14
Location: UK

#4 Post by pwdixon » 12 Dec 2009 21:07

This a probably really dumb, but.....

If you check all libraries does the compiler optimise out anything that isn't required?

If that's true then why not make the compiler clever enough to not even require any library checking at all?

Sobrietytest
Posts: 619
Joined: 05 Jul 2008 06:05
Location: Thailand

#5 Post by Sobrietytest » 13 Dec 2009 03:42

If you check all libraries does the compiler optimise out anything that isn't required?
Yes. The only difference is that the compiler will have to thumb through all the libraries to find the externals. The net result is the output will be the same - only the compiler will take a lot longer to do it. When people compare compilers, compilation speed is always a benchmark so I guess ME have to keep an eye on these metrics.

My example shows that you can choose a library (i.e. Mmc_fat) but that doesn't guarantee that it will work because it has dependencies in other libraries (i.e. C_Type). It would be nice if the dependent libraries were automatically selected when you pick your chosen library.

The problem is aggrevated because the 'Unresolved extern...' error doesn't indicate where the relevent external can be found - only the unit that's trying to call it. So you have two choices; you can either read through all the library functions to find the missing externals or go back and include all the libraries - which kind of defeats the point of having a Library Manager anyway!

pwdixon
Posts: 1431
Joined: 13 Apr 2005 11:14
Location: UK

#6 Post by pwdixon » 13 Dec 2009 04:38

So how about let the compiler try to compile while attempting to find any missing functions in all libraries and then automatically updating the library manager so that the next compilation will be quick.

Then on subsequent compilations if again any functions are missing look through the unchecked libraries and again automatically include any identified function libraries.

VCC
Posts: 463
Joined: 08 Jun 2009 18:31
Location: Romania

#7 Post by VCC » 13 Dec 2009 08:52

I was thinking of a list of functions and a corresponding list of libraries. Something like:

Code: Select all

//Functions on first column, library on second.
ADC1_Init                       ADC
ADC1_Init_Advanced              ADC
ADC1_Get_Sample                 ADC
ADC1_Read                       ADC
BitReverseComplex               BitReverseComplex
Button                          Button
CANSPISetOperationMode          CAN_SPI
   .                               .
   .                               .
   .                               .
Yes that is true that the compilation will be done more times until all necessary libraries will be ticked (this depends on how many unresolved externals the compiler reports on a compile). But this multi-step compiling is done only once, then after all used libraries are ticked, the compiling is done normally. I hope now my explanation is clear :D

peterverkaik
Posts: 174
Joined: 31 Aug 2009 22:44

#8 Post by peterverkaik » 13 Dec 2009 09:41

All these problems would not exist if we (can) just
put the dependecies in the file itself, the C way.
That is, if a file uses functions from c_type, use
#include <c_type.h>
No need for special IDE functions to include libraries.
It also has the benefit that when you create a slightly
altered version (using another name) you know
which other libraries are used.

regards peter

User avatar
marko.ziv
mikroElektronika team
Posts: 531
Joined: 06 Dec 2007 10:11
Contact:

#9 Post by marko.ziv » 14 Dec 2009 09:47

Hi,
would it be hard to implement a mechanism that parses the error message to extract the unresolved function name and based on that to automatically check the corresponding library from Library Manager ?
We will consider this and ways to implement it, or modify error messages so they are more clear on what to do to solve that error.

On other note one simple and quick way to check the correct library is to select, in this case, islower which is already highlighted in red, with cursor then hit F1 and the appropriate library page will open, that can give you a hint which library to check.
My example shows that you can choose a library (i.e. Mmc_fat) but that doesn't guarantee that it will work because it has dependencies in other libraries (i.e. C_Type). It would be nice if the dependent libraries were automatically selected when you pick your chosen library.
Actually if you select MMC there is no need for C_Type to bi included, however if you select MMC_FAT16 C_Type library will be checked.
All these problems would not exist if we (can) just
put the dependecies in the file itself, the C way.
That is, if a file uses functions from c_type, use
#include <c_type.h>
Search for LibDependency.ini file in the compilers folder there you will find settings for library dependencies, but remember to make a backup copy of it before editing just in case.

Best Regards

VCC
Posts: 463
Joined: 08 Jun 2009 18:31
Location: Romania

#10 Post by VCC » 14 Dec 2009 16:21

marko.ziv wrote:Hi,
would it be hard to implement a mechanism that parses the error message to extract the unresolved function name and based on that to automatically check the corresponding library from Library Manager ?
We will consider this and ways to implement it, or modify error messages so they are more clear on what to do to solve that error.
Thank you :D

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#11 Post by Mince-n-Tatties » 15 Dec 2009 17:09

marko.ziv wrote:Hi,
Search for LibDependency.ini file in the compilers folder there you will find settings for library dependencies, but remember to make a backup copy of it before editing just in case.
you can also view the tree in the compiler help file

F1, search with "Library Dependencies" to view the tree.

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 Beta Testing”